function popup(mylink, windowname, width, height, scroll)
{
//alert(scroll);
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	href=mylink;
	else
	href=mylink.href;
	if (scroll==1)
    {
//alert(scroll);
	    window.open(href, windowname, 'scrollbars=yes,status=no,width='+width+',height='+height);
    }
	else
	{
	    window.open(href, windowname, 'scrollbars=no,status=no,width='+width+',height='+height);
    }
	return false;
} 
	
	
function textCounter(fieldlength, countfield, maxlimit)
{
	if (fieldlength > maxlimit) // if too long...trim it!
	countfield.value='Too long'
	else 
	countfield.value = maxlimit - fieldlength;
}


function  shippingOpen() {
	Shadowbox.open({player: 'iframe', 
		title: '', 
		content: '/Shipping-Info.aspx', 
		height: 605, 
		width: 850 });
}


function bUpdate()
{
	document.basket.action.value='update';
	document.basket.submit();
}
function bEmpty()
{
	document.basket.action.value='empty';
	document.basket.submit();
}
function bDelete( sID )
{
	eval( 'document.basket.qty_' + sID ).value='0';
	document.basket.action.value='update';
	document.basket.submit();
}
	
	
function changeSize(siz){

	//document.basket_submit.size.value=document.basket_submit.size_id.selectedIndex.value;
	document.basket_submit.size.value=document.basket_submit.size_id.options[document.basket_submit.size_id.selectedIndex].text
}

function changeColour(mylink){
	
	
	
	//window.location=url;
	
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	//window.open(href, 'windowname', 'scrollbars=no,status=no,width=35,height=35');
	window.location=mylink
	return false;
	
}


function product_popUp(mylink, windowname, width, height )
{
	
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'scrollbars=no,status=no,width='+width+',height='+height);
	return false;
} 


function size_popUp(mylink, windowname, width, height )
{
	
	
	if (! window.focus)return true;
	var href;
	if (typeof(mylink) == 'string')
	   href=mylink;
	else
	   href=mylink.href;
	window.open(href, windowname, 'scrollbars=no,status=no,width='+width+',height='+height);
	return false;
}


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];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


		function SetViewAllPage(sViewAll)
		{
			document.forms.searchform.viewall.value = sViewAll;
			document.forms.searchform.submit();			
		}
	
	
function toggleLayer(whichLayer){
		
		
		if (document.getElementById)
		{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
		}
		else if (document.all)
		{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
		}
		else if (document.layers)
		{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
		}
}




function showDiscounts(cid,whichLayer){
	
	if (cid==2){
		if (document.getElementById)
		{
			
			var style2 = document.getElementById(whichLayer).style;
			style2.display = "block";
			
		}
		else if (document.all)
		{
			var style2 = document.all[whichLayer].style;
			style2.display = "block";
			
		}
		else if (document.layers)
		{
				var style2 = document.layers[whichLayer].style;
				style2.display = "block";
			
		}
	
	}else{
	
		//var style2 = document.all[whichLayer].style;
		//style2.display = "";
		if (document.getElementById)
		{
			
			var style2 = document.getElementById(whichLayer).style;
			style2.display = "";
			
		}
		else if (document.all)
		{
			var style2 = document.all[whichLayer].style;
			style2.display = "";
			
		}
		else if (document.layers)
		{
				var style2 = document.layers[whichLayer].style;
				style2.display = "";
			
		}
	}


}





// Add bookmark for both browser engines...
function addBookmark(title,url) {
  if (window.sidebar) {
    window.sidebar.addPanel(title, url,"");
  } else if( document.all ) {
    window.external.AddFavorite( url, title);
  } else if( window.opera && window.print ) {
    return true;
  }
}


  


function setCookie(c_name,value,expiredays)
{
var exdate=new Date()
exdate.setDate(exdate.getDate()+expiredays)
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate)


}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
	
	
	
    } 
  }
return null
}





function goBrand(){
	
	
	url=document.frmbrowse.brand_lc.options[document.frmbrowse.brand_lc.selectedIndex].value ;
	if (url!=0){
		window.location=url	
	}
}

function goBrand2(){
	
	
	url=document.frmbrowse.brand_lc2.options[document.frmbrowse.brand_lc2.selectedIndex].value ;
	if (url!=0){
		window.location=url	
	}
}

function goBrand3(){
		
	url=document.frmRightbrand.brand_lc.options[document.frmRightbrand.brand_lc.selectedIndex].value ;
	if (url!=0){
		window.location=url	
	}
}



function goRightSelector(){
		//alert(document.frmRightSelector.rightSelector.options[document.frmRightSelector.rightSelector.selectedIndex].value);
	url=document.frmRightSelector.rightSelector.options[document.frmRightSelector.rightSelector.selectedIndex].value ;
	if (url!=0){
		window.location=url	
	}
}

function displayChange(toggleid, buttonOnID, buttonOffClass, buttonOnClass) 
{
	var toggle 		= document.getElementById(toggleid);
	var buttonOn 	= document.getElementById(buttonOnID);
	
	if(toggle.style.display == 'none')
	{
		toggle.style.display = 'block';
		buttonOn.className = buttonOffClass;
	}
	else
	{
		toggle.style.display = 'none';
		buttonOn.className = buttonOnClass;
	}
}




