
function OnDescription( url, width, height )
{ 
	w = (width != null) ? width : 700;
	h = (height != null) ? height : 580;

	
	if (screen) {
		leftPos = screen.width/2-w/2
		topPos = screen.height/2-h/2
	}
	photoWin =  window.open( url, null, "width="+w+",height="+h+",top="+topPos+",left="+leftPos+",location=no,menubar=no,scrollbars=no,toolbar=no,resizable=yes", "true"); 
	photoWin.focus();
}



function OnMailWindow( url ){
  	window.open(url,"zoom_popup","toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1,width=350,height=600");
}

function OnComparePrint( lang, currency, params )
{
	OnDescription("/Print/Print.aspx?Page=CompareFeaturesPrint&PrintMode=1&L=" + lang + "&C=" + currency + "&Params=" + params);	
}

function OnCatalogPrint( lang, currency ) {
	OnDescription("/Print/Print.aspx?Page=CatalogPrint&L=" + lang + "&C=" + currency);
}

function OnItemPrint( id ) {
	OnDescription("/Print/Print.aspx?Page=ItemPrint&ID=" + id);
}

function OnLeasingPrint( id, price ) {
	OnDescription("/Print/Print.aspx?Page=LeasingPrint&ID=" + id + "&Price=" + price);
}

function OnItemGallery( lang, currency, accountCode ) {
	OnDescription("/Print/Print.aspx?Page=ItemGallery&L=" + lang + "&C=" + currency + "&AccountCode=" + accountCode);
}

function OnToCart( id ) {	
	OnToCart( id, '1' );
}

function OnToCart( id, q ) {	
	
	url = window.document.URL.replace("=", "|").replace("=", "|").replace("=", "|");
	SetCookie("url", url);
	location.href = 'default.aspx?Page=ToCart&ID=' + id + '&Q=' + q;
}


function OnReturnToBuy( defaultvalue ) {
	window.location.href = GetValue("url", defaultvalue ).replace("|", "=").replace("|", "=").replace("|", "=");	
}

function OnCheckBox( id ){	
	var checkbox;
	
	if( id.checked )
	{
		checkbox = GetValue("checkbox", "" )
		checkbox = checkbox + "," + id.value;
		SetCookie("checkbox", checkbox);
	}
	else
	{
		checkbox = GetValue("checkbox", "" )
		checkbox = checkbox.replace("," + id.value, "");
		SetCookie("checkbox", checkbox);
	}
}

function OnStepN( lang, nr ) {
	window.location.href = 'default.aspx?Page=Cart' + nr + lang;
}

function OnCartPrint( lang, currency ) {
	OnDescription("/Print/Print.aspx?Page=CartPrint&PrintMode=1&L=" + lang + "&C=" + currency);
}

function OnCart4Print( lang, currency ) {
	OnDescription("/Print/Print.aspx?Page=Cart4Print&PrintMode=1&L=" + lang + "&C=" + currency);
}

function OnCart5Print() {
	OnDescription("/Print/Print.aspx?Page=Cart5Print&PrintMode=1");
}

function OnAgreePrint( lang ) {
	OnDescription("/Print/Print.aspx?Page=AgreePrint&L=" + lang);
}

//-----------------------------------------------------------------------------------------

function NameDefined(ckie,nme)
{
   var splitValues
   var i
   for (i=0;i<ckie.length;++i)
   {
      splitValues=ckie[i].split("=")
      if (splitValues[0]==nme) return true
   }
   return false
}
function DelBlanks( strng )
{
   var result=""
   var i
   var chrn
   for (i=0;i<strng.length;++i) {
      chrn=strng.charAt(i)
      if (chrn!=" ") result += chrn
   }
   return result
}

function GetValue( cname, defaultvalue ) {  
   var cookie = document.cookie           
   var chkdCookie = DelBlanks(cookie)  
   var nvpair = chkdCookie.split(";")
   if(NameDefined(nvpair,cname))       
   {   
      tvalue = GetCookieValue(nvpair,cname) 
      return tvalue;	  
   }
   else return defaultvalue;
}

function GetCookieValue( ckie, nme )
{
   var splitValues
   var i
   for(i=0;i<ckie.length;++i) {
      splitValues=ckie[i].split("=")
      if(splitValues[0]==nme) return splitValues[1]
   }
   return ""
}

function SetCookie( cname, cvalue ) {
      var futdate = new Date()		
      var expdate = futdate.getTime() 
      expdate += 24*3600*1000  //expires in 24 hour(milliseconds)
      futdate.setTime(expdate)
      var newCookie= cname + "=" + cvalue + "; path=/;"	//Set the new cookie values up
      newCookie += " expires=" + futdate.toGMTString()
      window.document.cookie = newCookie 
      
}

//-----------------------------------------------------------------------------------------


function OnPriceChange( code, isDiscount ) { 
	window.open( "/Pub/PriceChange.aspx?itemcode=" + code + "&isDiscount=" + isDiscount, null, "width=780,height=400,location=no,menubar=no,scrollbars=no,toolbar=no", "true"); 
}

function OnGlossaryWord( gid ) {	
	OnDescription( "/Print/Print.aspx?Page=GlossaryInner&gid=" + gid, 400, 320);
}


function OnRepairPrint() {
	OnDescription("/Print/Print.aspx?Page=RepairPrint");
}

function OnGlossaryPrint( gid ) {	
	OnDescription( "/Print/Print.aspx?Page=GlossaryPrint&char=" + gid);	
}

function OnCalcPrint() {
	OnDescription("/Print/Print.aspx?Page=CalculatorPrint");
}

function OnCart3Print() {
	OnDescription("/Print/Print.aspx?Page=Cart3Print&PrintMode=1");
}

function OnCartCurrentPrint( orderID, lang, currency ) {
	OnDescription("/Print/Print.aspx?Page=CartCurrentPrint&PrintMode=1&OrderID=" + orderID + "&L=" + lang + "&C=" + currency);
}

function OnBuy() {
	window.location.href = '/Pub/?Page=Cart';
}

function OnNewPrint(ID) {
	OnDescription("/Print/Print.aspx?Page=NewsPrint&ID=" + ID);	
}	

function OnPlus( quantity ) {
	if (!isNaN(quantity.value)) quantity.value++;	
	else quantity.value = 1; 
	quantity.select()	
	evaluateObjectResult( quantity )
}

function OnMinus( quantity ) {
	if (!isNaN(quantity.value) && quantity.value>1) quantity.value--;
	else quantity.value='1'; 
	quantity.select();
	evaluateObjectResult( quantity )
	return false;
}

function doURL( url )
{	
	self.parent.location.href = url;
}


