<!--
function closeAllSubMenu()
{
	if ( document.getElementById('menuMain') == null ) return;
	
    if ( document.getElementById('menuMain') == null ) 
        return;
	var arrayDiv = document.getElementById('menuMain').getElementsByTagName('div');
		arrayLI = document.getElementById('menuMain').getElementsByTagName('li');
	for (i = 0; i < arrayDiv.length; i++)
	arrayDiv[i].style.visibility='hidden';
	for (i = 0; i < arrayLI.length; i++)
        if ( arrayLI[i].getElementsByTagName('div').length != 0 )
	arrayLI[i].className = 'none';
}

function searchDIV(nameDiv)
{
	var arrayDiv = document.getElementsByTagName('div');	
	i = 0;
	while( ( i < arrayDiv.length ) && ( arrayDiv[i].className != nameDiv ) ) i++;
	return arrayDiv[i];
}

function widthDIV(nameDiv){ return searchDIV(nameDiv).offsetWidth;}


function searchCSSName( nameCSS )
{
	//	rul = document.styleSheets[0].cssRules;
		rul = document.styleSheets[0].rules;
		i = 0;
		while( ( i<rul.length ) && ( rul[i].selectorText != nameCSS ) ) i++;
		if( ( i != rul.length )&&( rul[i].selectorText == nameCSS ) ) return( rul[i] );
		return( null );
			
}

function displaySubMenu(itemName, subName)
{		
		closeAllSubMenu();
		document.getElementById(subName).style.visibility='visible';
		if (document.getElementById(itemName).className == 'lastItem') document.getElementById(itemName).className = 'chosen_lst';
		else document.getElementById(itemName).className = 'chosen';
			
		if ( document.getElementById(subName).style.left == '' )
		{			
			if (document.getElementById(searchDIV('menuMain').className) != null)
			{				
				leftPosition_Submenu = ( document.getElementById(itemName).offsetLeft + document.getElementById(itemName).offsetWidth/2 ) - document.getElementById(subName).offsetWidth/2;
				widthMenu = widthDIV('menuMain');
				if ( (leftPosition_Submenu+document.getElementById(subName).offsetWidth) > widthMenu )
				document.getElementById(subName).style.left = widthMenu-document.getElementById(subName).offsetWidth + 'px';
				else if ( leftPosition_Submenu < 0 )
				document.getElementById(subName).style.left = 0 + 'px'
				else document.getElementById(subName).style.left = leftPosition_Submenu + 'px';
			}
		}
				
		if (( document.styleSheets )&&( (css = searchCSSName( '.subMenuMain_exp' ) ) !=  null) ) document.getElementById(subName).style.marginTop = css.style.marginTop;
}
//-----------------------------------------------------------------------------		   
function hideSubMenu(itemName, subName)
{
		document.getElementById(subName).style.visibility='hidden';
		if (document.getElementById(itemName).className == 'chosen') document.getElementById(itemName).className = 'none';
		else document.getElementById(itemName).className = 'lastItem';
}
//-----------------------------------------------------------------------------
function openAdditionalImagesWindow(url, maxImageWidth, maxImageHeight) {    
    window.open (url, "moreImagesWindow","location=0,resizable=1,status=1,scrollbars=1,width="+maxImageWidth+",height="+maxImageHeight); 
    }
//-----------------------------------------------------------------------------
function createLinkAndGo( url, pageAlias )
{
    var splittedUrl = url.split(",")
    var baseUrl = splittedUrl[0];    
    var sortDirection;
	if ( document.getElementById("psfoa").checked )
	{
		sortDirection = 'a';
	}
	else
	{
		sortDirection = 'd';
	}
	
	var productsPerPage = document.getElementById("productRPP").value;
	var brandId =  document.getElementById("pffv").value;
	var sortBy = document.getElementById("psf").value;
	var addition="";
	
	var newURL = baseUrl + "," + "1" + "," + productsPerPage + "," + sortBy + "," + sortDirection;
	
	if ( pageAlias != 'brands' )
	{
	    newURL = newURL + "," + 4 + "," + 31;
	    var addition;
	    if (brandId != "")
	    {
    	    addition = "," + brandId;
	    }    
	}	
	window.location = newURL + addition;
	return false;
}
//-----------------------------------------------------------------------------
function CheckIfCookiesEnabledInBrowser(){
    var cookieEnabled=(navigator.cookieEnabled)? true : false;

    if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
        document.cookie="testcookie";
        cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false;
    }

    if (!cookieEnabled){
        alert("We have detected that cookies are disabled in your browser. Please enable cookies in your browser settings for the shopping cart to function properly.");
    }
}

//-----------------------------------------------------------------------------
 function Bookmark(){
    var url = document.location.href;
    var title = document.title;
    if(title == "" || title == null)
    {
        title = "Untitled Page";
    }       
    
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
    {
       
        window.external.AddFavorite(url, title);
    } 
    else
    {
        if (navigator.appName == "Netscape") 
        {
           
            window.sidebar.addPanel(title,url,"");
        }
        else    
        {
            alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
        }
    }
}
//-----------------------------------------------------------------------------
var cookieName = "cameFromTopMenu";
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
//-----------------------------------------------------------------------------
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
//-----------------------------------------------------------------------------
function eraseCookie(name) {
	createCookie(name,"",-1);
}
//-----------------------------------------------------------------------------
function setCameFromTopMenuCookie(cameFromTopMenuCookie) {
    eraseCookie(cookieName);
	createCookie(cookieName, cameFromTopMenuCookie); 
}
//-----------------------------------------------------------------------------
function continueShopping(){    
    if ( readCookie(cookieName) == 'false' ){
        history.go(-2);
        }
    else{
        window.open("../../../");
        }
        
}

//-----------------------------------------------------------------------------
var options = new Array();  
var secondPriceOptions = new Array();
//-----------------------------------------------------------------------------
function select_onchange(selectedElementId) 
{
	var selectedElement = GetElementById(selectedElementId);
  var selectedItem = selectedElement.options[ selectedElement.selectedIndex ];
	options[selectedElementId] = selectedItem.getAttribute( "normalizedPrice" );	
	var normalizedPriceSecond = selectedItem.getAttribute( "normalizedPriceSecond" );
	if (normalizedPriceSecond != null){
	    secondPriceOptions[selectedElementId] = normalizedPriceSecond;
	}  	
	else
	{
	    secondPriceOptions[selectedElementId] = 0;
	}
	GetPrice();
}
//-----------------------------------------------------------------------------
function check_onclick(checkElementId)
{	
	var checkElement = GetElementById(checkElementId);
	var checkValue = checkElement.checked;
	if(checkValue == true)
	{
	  var normalizedPriceSecond = checkElement.getAttribute( "normalizedPriceSecond" );
	    if (normalizedPriceSecond != null){
	        secondPriceOptions[checkElementId] = normalizedPriceSecond;
	  }  	
	  else
	  {
	        secondPriceOptions[checkElementId] = 0;
	  }
	  options[checkElementId] = checkElement.getAttribute( "normalizedPrice" );	
      	
	}
	else
	{
		options[checkElementId] = 0;
		secondPriceOptions[checkElementId] = 0;
	}
	GetPrice();
}
//-----------------------------------------------------------------------------
function GetPrice()
{
	var formattedPriceElement1 = GetElementById("formattedPrice1");
	var formattedPriceElement2 = GetElementById("formattedPrice2");
	var formattedPriceElement3 = GetElementById("formattedPrice3");
	
	
	if(formattedPriceElement1 == null && formattedPriceElement2 == null && formattedPriceElement3 == null)
	{
	    
	    return;
	}
	
	var formattedPriceElement = 0;
	var hiddenPrice = 0;
	if(formattedPriceElement1 != null)
	{
	       formattedPriceElement = formattedPriceElement1;
	    var hiddenPrice =  GetElementById("priceValue");
	}
	if(formattedPriceElement2 != null)
	{
	    formattedPriceElement = formattedPriceElement2;
	    var hiddenPrice =  GetElementById("priceWTaxValue");
	}
	if(formattedPriceElement3 != null)
	{
	    GetPriceBoth();
	    return;
	}
	
	
	var oldProductPrice = formattedPriceElement.innerHTML;
	var pricePrefix = GetPricePrefix(oldProductPrice);
	var optionsPrice = 0;
	for (var i in options)
	{
		optionsPrice +=	parseFloat( options[i]);
	}

	 var priseSuffixsStringElement = GetElementById("priceSuffixString");
  	var suffixString = priseSuffixsStringElement.value;	
  	var decimalSeparatorElement = GetElementById("decimalSeparator");
  	var decimalSeparator =  decimalSeparatorElement.value;
  	var groupingSeparatorElement = GetElementById("groupingSeparator");
  	var groupingSeparator =  groupingSeparatorElement.value;  
  	var newPrice = formatCurrency(  (optionsPrice + parseFloat(hiddenPrice.value)), decimalSeparator , groupingSeparator);
  	formattedPriceElement.innerHTML = pricePrefix + " " + newPrice + suffixString ;
}
//-----------------------------------------------------------------------------
 function GetPriceBoth()
 {
	var formattedPriceElement = GetElementById("formattedPrice3");

	var hiddenPrice =  GetElementById("priceValue");
	var hiddenPriceWTax =  GetElementById("priceWTaxValue");
	
	var oldProductPrice = formattedPriceElement.innerHTML;
	var pricePrefix = GetPricePrefix(oldProductPrice);
	var optionsPrice = 0;
	var secondOptionsPrice = 0;
	for (var i in options)
	{
		optionsPrice +=	parseFloat( options[i]);
	}
	for (var i in secondPriceOptions)
	{
		secondOptionsPrice += parseFloat( secondPriceOptions[i]);
	}
  	var priseSuffixsStringElement = GetElementById("priceSuffixString");
  	var suffixString = priseSuffixsStringElement.value;
	
  	var decimalSeparatorElement = GetElementById("decimalSeparator");
  	var decimalSeparator =  decimalSeparatorElement.value;

  	var groupingSeparatorElement = GetElementById("groupingSeparator");
  	var groupingSeparator =  groupingSeparatorElement.value;

	var newPrice = formatCurrency(  (optionsPrice + parseFloat(hiddenPrice.value)), decimalSeparator , groupingSeparator);
	var newPriceWTax = formatCurrency(  (secondOptionsPrice + parseFloat(hiddenPriceWTax.value)), decimalSeparator , groupingSeparator);
 
 	formattedPriceElement.innerHTML = pricePrefix + " " + newPrice + ", " + pricePrefix + " " + newPriceWTax + "&#160;&#160;&#160;" + suffixString ;
 }
//-----------------------------------------------------------------------------
function formatCurrency(num, decimalSep, groupingSep) 
{
      num = num.toString().replace(/\$|\,/g,'');
      if(isNaN(num))
      num = "0";
      sign = (num == (num = Math.abs(num)));
      num = Math.floor(num*100+0.50000000001);
      cents = num%100;      
      num = Math.floor(num/100).toString();
      if(cents<10)
      cents = "0" + cents;


      for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
      num = num.substring(0,num.length-(4*i+3))+groupingSep+
       num.substring(num.length-(4*i+3));
      return (((sign)?'':'-') + num + decimalSep + cents);
}
//-----------------------------------------------------------------------------
function GetPricePrefix(price)
{
	if( price.length == 0)
	{
		return "";
	}
	var pref = "";
	for (var i=0; i < price.length ; i++) 
	{
		var ch = price.charAt(i);
		if(ch == " ")
		{
			return pref;		
		}
		pref +=  ch;
	} 	
	
	return price.charAt(i);
}
//-----------------------------------------------------------------------------
function GetElementById(id)
{
 	var oElement = null;
  	try
  	{
     		oElement = document.getElementById( id);
  	}
	catch(e)
  	{
     		oElement = null;
  	}
  	return oElement
}
//-----------------------------------------------------------------------------
