function getCookie(NameOfCookie){
    if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
        return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}


function checkCookie()
{
    var VATContainer = getCookie("projektorVAT");
    if ((VATContainer!=null) && (VATContainer!=""))
      {
      var xContainer = readCookie("projektorVAT");
          if(xContainer == "showVAT=yes")
          {
            document.getElementById("momsCheck").style.display = "none";
            document.getElementById("momsCheckOn").style.display = "block";
            document.getElementById("momsCheck").removeAttribute("checked");
            showPrice = showPriceWithVat;
          }
          else
          {
            document.getElementById("momsCheck").style.display = "block";
            document.getElementById("momsCheckOn").style.display = "none";
            showPrice = showPriceWithoutVat;
          }
      }
      else
      {
            //eraseCookie("projektorVAT");
            createCookie("projektorVAT","showVAT=no",1);
            document.getElementById("momsCheck").style.display = "block";
            document.getElementById("momsCheckOn").style.display = "none";
            showPrice = showPriceWithoutVat;
      }
      return showPrice;
}


var showPriceTag = "<!--@Ecom:Product.ActualPriceWithVAT-->";

function showTag()
{
    
    return showPriceTag;
}


function showTax() {
    //eraseCookie("projektorVAT");
    createCookie("projektorVAT","showVAT=yes",1);
    window.location.href=window.location.href;
}

function remTax()
{
    //eraseCookie("projektorVAT");
    createCookie("projektorVAT","showVAT=no",1);
    window.location.href=window.location.href;
    
}

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)
{
    var expdate = new Date();
    expdate.setTime(expdate.getTime() - 1);
    document.cookie = name += "=; expires=" + expdate.toGMTString();
}


//window.onload=function()
//{
 //checkCookie();
 //checkIMG();
 //checkSTOCK();
//}
