/* Top Common Menu script */
var arr_url = tmp_rootpath.split('/');
var regis = /registration/;
var ris_inside_reg = tmp_rootpath.search(regis);
//alert(ris_inside_reg);
if(ris_inside_reg == -1)
{
	sfHover = function() 
	{ 
		var sfEls = document.getElementById("navbar").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) 
		{
			sfEls[i].onmouseover=function() {var list = this.getElementsByTagName("UL")[0];if(list){list.style.left  = "auto";}};
			sfEls[i].onmouseout=function() {var list = this.getElementsByTagName("UL")[0];if(list){list.style.left  = "-999em";}}
		}
		
	};
	if (window.attachEvent){window.attachEvent("onload", sfHover);}if (window.addEventListener){window.addEventListener("load", sfHover, false);};
}


function openWin1(url)
{
var j=window.open(url,"jj","left=20, top=20, width=550,height=600,scrollbars=1") 
}

function openWin2(url)
{
var j=window.open(url,"jj","left=20, top=20, width=700,height=570,scrollbars=1") 
}

function openWin3(url)
{
var j=window.open(url,"jj","left=20, top=20, width=500,height=300,scrollbars=1") 
}

function openWinlarge(url)
{
var j=window.open(url,"jj","left=20, top=20, width=500,height=410,scrollbars=1") 
}

function openWin4(url)
{
var j=window.open(url,"jj","left=20, top=20, width=400,height=180,scrollbars=1") 
}
function openWin5(url)
{
var j=window.open(url,"jj","left=20, top=20, width=550,height=500,scrollbars=1") 
}

function openprint(url)
{
var j=window.open(url,"jj","left=20, top=20, width=900,height=900,scrollbars=1") 
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function changebg(elementId)
{
	fmobj	=	document.form1;
	re = /bigform12/gi;
	for (var i=0;i<fmobj.elements.length;i++) {
		var e = fmobj.elements[i];	
		if(e!=elementId)
			e.className = e.className.replace(re, '');
		else
			elementId.className += elementId.className+' bigform12';	
	}
	
	if(elementId.value.length>0)
		elementId.className += elementId.className+' bigform12';
}
function visibleMoreCat_presc(){
	if(document.getElementById("set_more_link").value == 0){
		document.getElementById("set_more_link").value = 1;
		document.getElementById("more_cat").style.display = "";
		document.getElementById("pres_dont").style.display ="none"
		
	}else{
		document.getElementById("set_more_link").value = 0;		
		document.getElementById("pres_dont").style.display =""
		document.getElementById("more_cat").style.display = "none";
	}
}
function visibleMoreCat(){
	
	if(document.getElementById("set_more_link").value == 0){
		document.getElementById("set_more_link").value = 1;
		document.getElementById("more_cat").style.display = "";
		document.getElementById("brandList").style.display = "none";
		document.getElementById("viewBrandLink").style.display = "none";
		document.getElementById("viewAllBrandLink").style.display = "";
		document.getElementById("backId").style.display = "";
		
		
		if(document.getElementById("pres_dont"))
		{
			document.getElementById("pres_dont").style.display = "none";
			document.getElementById("brandList").style.display = "";
			document.getElementById("viewBrandLink").style.display = "";
			document.getElementById("viewAllBrandLink").style.display = "none";
		}
	}else{
		document.getElementById("set_more_link").value = 0;
		document.getElementById("more_cat").style.display = "none";
		document.getElementById("brandList").style.display = "";
		document.getElementById("viewBrandLink").style.display = "";
		document.getElementById("viewAllBrandLink").style.display = "none";
		document.getElementById("backId").style.display = "";
		
		var newurl=document.getElementById("urlId").value+"#a";
		window.location= newurl;
		
		
		if(document.getElementById("pres_dont"))
		{
			document.getElementById("pres_dont").style.display = "";
			document.getElementById("brandList").style.display = "none";
			document.getElementById("viewBrandLink").style.display = "";
			document.getElementById("viewAllBrandLink").style.display = "none";
		}
	}
}
function paging_submit(form_action,form_name)
{
	theForm = document.getElementById(form_name);
	theForm.action = form_action;
	theForm.submit();
}
function changeView(view_type,form_name) // for view changing
{
	theForm = document.getElementById(form_name);
	theForm.vi.value = view_type;
	theForm.submit();
}
function doPriceSort(sortField,form_name) //for paging script
{ 	
	theForm = document.getElementById(form_name);
	theForm.ps.value = sortField;
	theForm.submit();
}
function filltextbox(i)
{
	var qty = document.getElementById('qty_sel_'+i).value;
	if(isNaN(qty))
	{
			document.getElementById('qty_sel_'+i).style.display = 'none';
			document.getElementById('qty_'+i).style.display = '';
			document.getElementById('qty_'+i).value = '21';
	}
	else
	{
		document.getElementById('qty_'+i).value = qty;
	}
}

/* Screen Resolution detection and set the variable for flash and div */
//to set dropdown position
var Left=0;
//alert(screen.width);
if(screen.width == 1088)
{
	image_name = 1024;
	width	   = 600;
	Left = 522;
}	
else if(screen.width == 1152)
{
	image_name = 1024;
	width	   = 600;
	Left = 585;
}	
else if(screen.width == 1280)
{
	image_name = 1200;
	width	   = 864;
	Left = 715;
}	
else if(screen.width >= 1300 && screen.width <= 1399)
{
	image_name = 1400;
	width	   = 1024;
	Left = 800;	
}	
else if(screen.width >= 1400 && screen.width <= 1499)
{
	image_name = 1400;
	width	   = 1024;
	Left = 1019;	
}	
else if(screen.width >= 1600 && screen.width <= 1699)
{
	image_name = 1400;
	width	   = 1024;
	Left = 900;		
}	
else if(screen.width >= 1700 && screen.width <= 1799)
{
	image_name = 1400;
	Left = 1000;		
	Left = 1000;		
}	
else
{
	image_name = 1024;
	width	   = 600;
	Left = 458;
}	

/* Text block default change and search functions*/

function clearSearchField(objText)
{
	if(trimAll(objText.value) == "Enter Product or Symptom")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Enter medicine name here")
	{
		objText.value='';
	}	
	else if(trimAll(objText.value) == "Enter Email Address")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Name")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Email")
	{
		objText.value='';
	}
	else if(trimAll(objText.value) == "Please Enter Your Review")
	{
		objText.value='';
	}
	objText.select();	
}

function defaultText(objText)
{
	if(isWhitespace(objText.value))
	{
		objText.value='Enter Product or Symptom';  	
	}
}

function doSearch()
{
	theForm = document.frmsearch;
	if(document.getElementById('q').value == 'Enter Product or Symptom')
	{
		theForm.q.value = "";
	}
	theForm.submit();
}
/* Preload images */
<!--
	function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
//-->
	MM_preloadImages('<?=$tmp_rootpath;?>images/txt_home.png','<?=$tmp_rootpath;?>images/txt_dog.png','<?=$tmp_rootpath;?>images/txt_cat.png','<?=$tmp_rootpath;?>images/txt_small_pet.png','<?=$tmp_rootpath;?>images/txt_equine.png','<?=$tmp_rootpath;?>images/txt_bird.png','<?=$tmp_rootpath;?>images/txt_aquatic_reptiles.png','<?=$tmp_rootpath;?>images/txt_farm.png','images/txt_offers.png','<?=$tmp_rootpath;?>images/link_home_over.gif','<?=$tmp_rootpath;?>images/link_prescriptions_over.gif','<?=$tmp_rootpath;?>images/link_embarrassing_over.gif','<?=$tmp_rootpath;?>images/link_medicines_over.gif','<?=$tmp_rootpath;?>images/link_sexual_health_over.gif','<?=$tmp_rootpath;?>images/link_health_over.gif','<?=$tmp_rootpath;?>images/link_toiletries_new_over.gif','<?=$tmp_rootpath;?>images/link_vitamins_over.gif','<?=$tmp_rootpath;?>images/link_beauty_over.gif','<?=$tmp_rootpath;?>images/link_for_men_over.gif','<?=$tmp_rootpath;?>images/link_fragrances_over.gif','<?=$tmp_rootpath;?>images/link_offers_new_over.gif','<?=$tmp_rootpath;?>images/Loader.gif', '<?=$tmp_rootpath;?>images/buttons/arrow_down.gif','<?=$tmp_rootpath;?>images/link_baby_over.gif','<?=$tmp_rootpath;?>images/link_electricals_over.gif','<?=$tmp_rootpath;?>images/link_travel_over.gif','<?=$tmp_rootpath;?>images/link_pets_new_over.gif','<?=$tmp_rootpath;?>images/scholl_about.gif','<?=$tmp_rootpath;?>images/scholl_about_over.gif','<?=$tmp_rootpath;?>images/scholl_news_blogs.gif','<?=$tmp_rootpath;?>images/scholl_news_blogs_over.gif','<?=$tmp_rootpath;?>images/scholl_resource.gif','<?=$tmp_rootpath;?>images/scholl_resource_over.gif','<?=$tmp_rootpath;?>images/scholl_reviews.gif','<?=$tmp_rootpath;?>images/scholl_reviews_over.gif','<?=$tmp_rootpath;?>images/scholl_shop.gif','<?=$tmp_rootpath;?>images/scholl_shop_over.gif','<?=$tmp_rootpath;?>images/pop_up_bg.gif');