function printPage() {
	var mywindow = window.open('/en_us/jsp/pet_health/print-view.jsp',
			'my_div', 'height=400,width=600,scrollbars=yes');
	mywindow.print();
}

function getAccount() {
	var url = window.location.href.toLowerCase();
	var GAaccount = "UA-3106234-1";

	if (Number(url.indexOf("en-ca")) != -1) {
		GAaccount = "UA-19080272-1";
	} else if (Number(url.indexOf("fr-ca")) != -1) {
		GAaccount = "UA-19080272-2";
	} else if (Number(url.indexOf("/en/")) != -1) {
		GAaccount = "UA-19080272-1";
	} else if (Number(url.indexOf("/fr/")) != -1) {
		GAaccount = "UA-19080272-2";
	}
	return GAaccount;
}
$(document)
		.ready(
				function() {

					// change image on hover//
					$("img.hovereffect, input.hovereffect").hover(
							function() {
								$(this).attr(
										"src",
										$(this).attr("src").split(".").join(
												"_hover."));
							},
							function() {
								$(this).attr(
										"src",
										$(this).attr("src").split("_hover.")
												.join("."));
							});

					$("input.text").focus(function() {
						$(this).attr('value', ' ');
					});
					/*
					 * search box blank, when user focus
					 * 
					 * $("input.text").focus(function() { $(this).attr('value', '
					 * '); });
					 * 
					 * $("input.text").blur(function() { $(this).attr('value',
					 * 'Enter Keyword'); });
					 * 
					 */

					// utility nav
					$('div#selectcountry').hide();
					$("a.selectcountry, div#selectcountry").hover(function() {
						$('div#selectcountry').show();

					}, function() {
						$('div#selectcountry').hide();

					});

					$('div#sharemenu').hide();
					$("a.Share, div#sharemenu").hover(function() {
						$('div#sharemenu').show();

					}, function() {
						$('div#sharemenu').hide();

					});

					$('div#followmenu').hide();
					$("a.Follow, div#followmenu").hover(function() {
						$('div#followmenu').show();

					}, function() {
						$('div#followmenu').hide();

					});

					/* navigation image on hover */
					$("#MainNav img").hover(
							function() {
								$(this).attr(
										"src",
										$(this).attr("src").split(".").join(
												"_hover."));
							},
							function() {
								$(this).attr(
										"src",
										$(this).attr("src").split("_hover.")
												.join("."));
							});

					// navigation image on hover

					/* about us */

					$("li#about-us").hover(function() {
						$('div#subnav-about-us, span#about-us-h-img').show();

					}, function() {
						$('div#subnav-about-us, span#about-us-h-img').hide();

					});

					/* products */

					$("li#products").hover(function() {
						$('div#subnav-products, span#products-h-img').show();

					}, function() {
						$('div#subnav-products, span#products-h-img').hide();

					});

					/* pet-health */

					$("li#pet-health")
							.hover(
									function() {
										$(
												'div#subnav-pet-health, span#pet-health-h-img')
												.show();

									},
									function() {
										$(
												'div#subnav-pet-health, span#pet-health-h-img')
												.hide();
									});

					/* rescue-pets */

					/*
					 * $("li#rescue-pets").hover(function() {
					 * $('div#subnav-rescue-pets, span#rescue-pets-h-img,
					 * div#subnav-rescue-pets .subnav-content').show();
					 *  }, function() { $('div#subnav-rescue-pets,
					 * span#rescue-pets-h-img, div#subnav-rescue-pets
					 * .subnav-content').hide(); });
					 * 
					 */
					$("li#rescue-pets")
							.hover(
									function() {
										$(
												'div#subnav-rescue-pets, span#rescue-pets-h-img')
												.show();

									},
									function() {
										$(
												'div#subnav-rescue-pets, span#rescue-pets-h-img')
												.hide();

									});

					/* close section */

					$(".close").click(function() {
						$('div.subnav-container').hide();

					});

					/* Product section */

					$('.dog div.forcat, ').hide();
					$('.cat div.fordog, ').hide();
					$("a.showcat").mouseover(function() {
						$('div.forcat').show();
						$('div.fordog').hide();

					});
					$("a.showdog").mouseover(function() {
						$('div.fordog').show();
						$('div.forcat').hide();

					});

					/* advanced search toggle */
					var test = $("#showAdvnSearch").val();
					$(
							"div.advanced-search-box, div.advanced-search a font,img.close")
							.hide();
					$("div.advanced-search a, a.advanced-search")
							.toggle(
									function() {
										if (test != "null") {
											$(
													"div.advanced-search-box, div.advanced-search a font, img.close")
													.hide();
											$("img.open").show();
										} else {
											$(
													"div.advanced-search-box, div.advanced-search a font, img.close")
													.show();
											$("img.open").hide();
										}
									},
									function() {
										if (test != "null") {
											$(
													"div.advanced-search-box, div.advanced-search a font, img.close")
													.show();
											$("img.open").hide();
										} else {
											$(
													"div.advanced-search-box, div.advanced-search a font, img.close")
													.hide();
											$("img.open").show();
										}
									});

					if (test != "null") {
						$(
								"div.advanced-search-box, div.advanced-search a font, img.close")
								.show();
						$("img.open").hide();
					}
					/*
					 * $(".advanced-search-box,div.advanced-search a font,
					 * img.close").hide(); $("a.advanced-search,
					 * .advanced-search a").click(function () {
					 * $(".advanced-search-box").slideToggle("fast"); });
					 * 
					 * $(".advanced-search a").click(function(){
					 * $(".advanced-search a font,img.close").show();
					 * $("img.open").hide(); },function(){ $(".advanced-search a
					 * font, img.close").hide(); $("img.open").show(); });
					 */

					/* Print button */

					$("img.print-tooltip").hide();
					$("a.print-btn").mouseover(function() {
						$("img.print-tooltip").show();
					});

					$("a.print-btn").mouseout(function() {
						$("img.print-tooltip").hide();

					});

					/*
					 * open popup
					 * 
					 * 
					 */

					// Hook up the print link.
					$(".pop").attr("href", "javascript:void( 0 )").click(
							function() {
								// Print the DIV.
								$(".txt-content").print();
								// Cancel click event.
								return (false);
							});

					/*
					 * 
					 * Guide indexing
					 * 
					 */

					$("a.showall").click(function() {

						$('div.guide_list_results hr').hide();
						$('a.showall').hide();
					});

					$("div.alphabetic_order a").click(function() {
						// e.preventDefault();
						// $('div.guide_list_results').hide();
						$('div.guide_list_results').show();
						$('div.guide_list_results hr').hide();
						$('a.showall').show();
					});
					/*
					 * 
					 * 
					 * $('div.guide_list_results').hide(); $('.guide_list
					 * hr').hide(); $('div.#div_1').show();
					 * 
					 * 
					 * 
					 * $("a.showall").click(function() {
					 * $('div.guide_list_results').show(); $('.guide_list
					 * hr').show(); $('a.showall').hide(); });
					 * 
					 * $("div.alphabetic_order a").click(function(e){
					 * e.preventDefault(); $('div.guide_list_results').hide();
					 * $('.guide_list hr').hide(); $('a.showall').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_1").click(function() {
					 * $('div.#div_1').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_2").click(function() {
					 * $('div.#div_2').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_3").click(function() {
					 * $('div.#div_3').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_4").click(function() {
					 * $('div.#div_4').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_5").click(function() {
					 * $('div.#div_5').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_6").click(function() {
					 * $('div.#div_6').show(); });
					 * 
					 * 
					 * $("div.alphabetic_order a.#href_7").click(function() {
					 * $('div.#div_7').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_8").click(function() {
					 * $('div.#div_8').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_9").click(function() {
					 * $('div.#div_9').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_10").click(function() {
					 * $('div.#div_10').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_11").click(function() {
					 * $('div.#div_11').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_12").click(function() {
					 * $('div.#div_12').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_13").click(function() {
					 * $('div.#div_13').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_14").click(function() {
					 * $('div.#div_14').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_15").click(function() {
					 * $('div.#div_15').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_16").click(function() {
					 * $('div.#div_16').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_17").click(function() {
					 * $('div.#div_17').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_18").click(function() {
					 * $('div.#div_18').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_19").click(function() {
					 * $('div.#div_19').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_20").click(function() {
					 * $('div.#div_20').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_21").click(function() {
					 * $('div.#div_21').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_22").click(function() {
					 * $('div.#div_22').show(); });
					 * 
					 * $("div.alphabetic_order a.#href_23").click(function() {
					 * $('div.#div_23').show(); });
					 */
					$('a.coll-close').hide();
					$('div.collapsiblepanel').hide();

					$("div.collapsiblebtn a.coll-open").click(function() {

						$('div.collapsiblepanel').show();
						$('a.coll-close').show();
						$('a.coll-open').hide();
					});

					$("div.collapsiblebtn a.coll-close").click(function() {
						$('div.collapsiblepanel').hide();
						$('a.coll-close').hide();
						$('a.coll-open').show();
					});

					/*
					 * ==============================================
					 * 
					 * tabs navigation panel style
					 * 
					 * 
					 */

					$('ul.tabNav a')
							.click(
									function() {
										var curChildIndex = $(this).parent()
												.prevAll().length + 1;
										$(this).parent().parent().children(
												'.current').removeClass(
												'current');
										$(this).parent().addClass('current');
										$(this)
												.parent()
												.parent()
												.next('.tabContainer')
												.children('.current')
												.show(
														'fast',
														function() {
															$(this)
																	.removeClass(
																			'current');
															$(this)
																	.parent()
																	.children(
																			'div:nth-child('
																					+ curChildIndex
																					+ ')')
																	.hide(
																			'fast',
																			function() {
																				$(
																						this)
																						.addClass(
																								'current');
																			});
														});
										return false;
									});

					/* iams product header tabs */

					// $(function() {
					// setup ul.tabs to work as tabs for each div directly under
					// div.panes
					// $("ul.htabs").tabs("div.panes > div");
					// });
					/* Video Syndication Embed and Transcript */

					$(".embed").click(function() {
						$('.embed-code').toggle();
						$('.transcript-code').hide();
					});

					$(".transcript").click(function() {
						$('.transcript-code').toggle();
						$('.embed-code').hide();
					});

					/* Buy now page - Help icon tool tip open */

					$(".help-icon").click(function() {
						$(".txt-content ul li ul").hide();
						$(this).parent("li").find("ul").show();
					});

					$("ul.step1-option li ul").click(function() {
						$(this).hide();
					});

					/* End of Tool tip function */

					$(".chart-helptool").click(function() {
						$(".chart-list li div div").hide(); // Delete this line
															// if
						// multiple tool tip
						// need to remain open
						// like live site
						$(this).parent("li").find("div").show();
					});

					$(".chart-list li div div").click(function() {
						$(this).hide();
					});

					// GSA search tooltip function
					$("ul.searchtips").hide();
					$(".gsasearch .help-icon").click(function() {
						$("ul.searchtips").show();
						// $(this).parent("li").find("ul").show();
					});

					$("ul.searchtips img").click(function() {
						$("ul.searchtips").hide();
					});

					/* End of Tool tip function */

				});

var alertMsg;
function checkUserCookie() {
	if (get_cookie("envUser")) {
		alert(alertMsg);
		location.href = "/en-ca/index";
		return false;
	}else{
		return true;
	}
}

function get_cookie(cookie_name) {
	var results = document.cookie.match('(^|;) ?' + cookie_name
			+ '=([^;]*)(;|$)');
	//var results= document.cookie.match(cookie_name);
	if (results){
		return true;
	}
	else{
		return false;
	}	
}

