/* Top Common Menu script */
var arr_url = tmp_rootpath.split('/');
if(arr_url[3] != 'registration')
{
	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 priceRange(price,form_name,action_page) // for filtering by price range
{
	theForm = document.getElementById(form_name);
	theForm.price_range.value = price;
	if(action_page)
		theForm.action = action_page;
	theForm.submit();
}
function showVatIncExc(vat_value,form_name) // for view price with or without vat
{
	theForm = document.getElementById(form_name);
	theForm.show_price.value = vat_value;
	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;
	}
}
function filltextbox_search(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';
		showTotalPrice(i);
	}
	else
	{
		document.getElementById('qty_'+i).value = qty;
		showTotalPrice(i);
	}
}
/* 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 = 538;
}	
else if(screen.width == 1152)
{
	image_name = 1024;
	width	   = 600;
	Left = 602;
}	
else if(screen.width == 1280)
{
	image_name = 1200;
	width	   = 864;
	Left = 731;
}	
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 = 900;	
}	
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 = 473;
}	

/* Text block default change and search functions*/

function alertSize()
{
	var a=new Array();
	var b=0,myHeight=0;
	if(typeof(window.innerWidth)=='number')
	{
		b=window.innerWidth;myHeight=window.innerHeight
	}
	else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
	{
		b=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight
	}
	else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
	{
		b=document.body.clientWidth;myHeight=document.body.clientHeight
	}
	a[0]=b;a[1]=myHeight;
	return a
}


function clearSearchField(objText)
{
	if(trimAll(objText.value) == "Enter Product, Category or Brand")
	{
		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='';
	}
	else if(trimAll(objText.value) == "Model Number")
	{
		objText.value='';
	}
	else if(trimAll(objText.value).substr(18,8)=='feedback')
	{
		objText.value=''
	}
	objText.select();	
}

function defaultText(objText,TextFor)
{
	if(isWhitespace(objText.value) && TextFor == 'search')
	{
		objText.value='Enter Product, Category or Brand';  	
	}
	else if(isWhitespace(objText.value) && TextFor == 'newsletter')
	{
		objText.value='Enter Email Address';  	
	}
	else if(isWhitespace(objText.value) && TextFor == 'modelnumber')
	{
		objText.value='Model Number';  	
	}
	else if(isWhitespace(objText.value)&&TextFor=='suggestion')
	{
		objText.value='Please enter your feedback here, we very much appreciate customer feedback. We may not be able to respond to all comments but we endeavor to reply to all suggestions.'
	}
}

function doSearch()
{
	theForm = document.frmsearch;
	if(document.getElementById('q').value == 'Enter Product, Category or Brand')
	{
		theForm.q.value = "";
	}
	if(!isNaN(document.getElementById('q').value))
	{
		alert("Please enter a product name or keyword");
		document.getElementById('q').value = 'Enter Product, Category or Brand';
		document.getElementById('q').blur();
		return false;
	}
	else
	{
		theForm.submit();
	}
}
function HidedivCart(ele) // hide popup div
{
	document.getElementById(ele).style.visibility = 'hidden';
}

/* 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/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');
	
