<!--
function Set_Cookie(name, value, expires, path, domain, secure) 
{
	var today = new Date();
	today.setTime(today.getTime());

	if (expires) { expires = expires * 1000 * 60 * 60 * 24; }
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape(value) +
	(( expires) ? "; expires=" + expires_date.toGMTString() : "") + 
	(( path) ? "; path=" + path : "; path=/") + 
	(( domain) ? "; domain=" + domain : "") +
	(( secure) ? "; secure" : "");
}

function Get_Cookie(name) 
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ((!start) && (name != document.cookie.substring(0, name.length))) { return null; }
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
}

function Delete_Cookie( name, path, domain ) 
{
	if (Get_Cookie(name)) 
	{
	    document.cookie = name + "=" + ((path) ? ";path=" + path : "") + (( domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
	}
}

function getAct(obj)
{
   document.getElementById(obj).className = "arrow";
}

function getInact(obj)
{
   document.getElementById(obj).className = "bgWh";
}

var sessionOID = "<%# SessionOID%>";
var ctrls = new Array();
ctrls[ctrls.length] = "b_goodsCount";
  
function GetBasketInfo() 
{    
	ServiceUtility.GetInfo(sessionOID, GetBasketInfo_Callback);
}
function GetBasketInfo_Callback(response) 
{
    if(response.error != null) 
    {
		alet(response.error);
	}
	eval("var result = " + response.value);
	for(var i = 0; i < ctrls.length; i += 1) 
	{
		document.getElementById(ctrls[i]).innerHTML = result.Count;
	}
       
	var linkI = document.getElementById("hlBasketI");
	if(result.Count == 0) { linkI.href = "/catalog"; }
	else { linkI.href = "/basket"; }
	var obj = document.getElementById(result.id);
	obj.innerHTML = result.content;
}	
function AddToBasketOne(t) 
{
     ServiceUtility.AddToBasketOne(sessionOID, t.id.substr(4), AddToBasket_Callback);
} 
function AddToBasket_Callback(response) 
{   
    if(response.error != null) 
    {
	    alert(response.error);
	    return;
	}
	GetBasketInfo();
	Set_Cookie("resetAmount", "yes", 1);
    
	eval('var result = ' + response.value);
	var obj = document.getElementById(result.id);
	obj.innerHTML = result.content;
	self.location="/basket";
}
function AddToCompareCheck_Callback()
{
  var hWindow = window.open("/compare", "compare", "width=1000,height=780,left=10,top=10,menubar=1,resizable=1,scrollbars=1,titlebar=1");
}
function AddToCompare_Callback(response) 
{
	if(response.error != null) 
	{
	  alert(response.error);
	  return;
	}
	eval('var result = ' + response.value);
	
	if (result.Count > 0)
	{	   
	   if (document.getElementById('GoodsList1_MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('GoodsList1_MenuCompare1_div_compare').className = 'vis';
	   }
	   if (document.getElementById('MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('MenuCompare1_div_compare').className = 'vis';
	   }
	   if (document.getElementById('contentCtrl_MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('contentCtrl_MenuCompare1_div_compare').className = 'vis';
	   }
    }
    else
    {	
	   if (document.getElementById('GoodsList1_MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('GoodsList1_MenuCompare1_div_compare').className = 'hid';
	   }
	   if (document.getElementById('MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('MenuCompare1_div_compare').className = 'hid';
	   }
	   if (document.getElementById('contentCtrl_MenuCompare1_div_compare')!=null)
	   {
	      document.getElementById('contentCtrl_MenuCompare1_div_compare').className = 'hid';
	   }
    }	
	var obj = document.getElementById(result.id);
	obj.innerHTML = result.content;
}
function DeleteCompare_Callback(response) 
{
	if(response.error != null) 
	{
	  alert(response.error);
	  return;
	}
	eval('var result = ' + response.value);
	
	if (document.getElementById('GoodsList1_MenuCompare1_div_compare')!=null)
	{
	   document.getElementById('GoodsList1_MenuCompare1_div_compare').className = 'hid';
	}
	if (document.getElementById('MenuCompare1_div_compare')!=null)
	{
	   document.getElementById('MenuCompare1_div_compare').className = 'hid';
	}	
	if (document.getElementById('contentCtrl_MenuCompare1_div_compare')!=null)
	{
	   document.getElementById('contentCtrl_MenuCompare1_div_compare').className = 'hid';
	}
	var obj = document.getElementById(result.id);
	if (obj!=null)
	{
	    obj.innerHTML = result.content;
	}
}
function AddToCompareCheck() 
{
	var inputs = document.getElementsByTagName("input");
	var amount = "[ ";
	for(var i = 0; i < inputs.length; i++) 
	{
		var input = inputs[i];
		var j = 0;
		if(input.id.toLowerCase().indexOf("cb_") != -1 && input.checked) 
		{
			amount += "{OID:"+input.id.substr(3)+", amount:1}, ";
			input.value = "";
		}
	}
	amount = amount.substr(0, amount.length - 2);
	if(amount.length != 0) 
	{
		amount += "]";
		var sessionUSER=Get_Cookie("Session");
        if (sessionUSER != null)
        {
           sessionUSER = sessionUSER.substring(sessionUSER.indexOf("=")+1, sessionUSER.length);
        }
        else
        {
           sessionUSER = sessionOID;
           Set_Cookie("Session", sessionOID, 30);
        } 
	    ServiceUtility.UpdateCheckAllCompare(sessionUSER, amount, AddToCompareCheck_Callback);
	}
}
function UpdateCompare(t) 
{
    var sessionUSER=Get_Cookie("Session");
    if (sessionUSER != null)
    {
        sessionUSER = sessionUSER.substring(sessionUSER.indexOf("=")+1, sessionUSER.length);
    }
    else
    {
        sessionUSER = sessionOID;
        Set_Cookie("Session", sessionOID, 30);
    }    
	ServiceUtility.UpdateCheckCompare(sessionUSER, t.id.substr(3));
}
function LoadCompare() 
{
    var sessionUSER=Get_Cookie("Session");
    if (sessionUSER != null)
    {
        sessionUSER = sessionUSER.substring(sessionUSER.indexOf("=")+1, sessionUSER.length);
    }
    else
    {
        sessionUSER = sessionOID;
        Set_Cookie("Session", sessionOID, 30);
    }    
	ServiceUtility.GetCompare(sessionUSER, AddToCompare_Callback);
}
function DeleteCompare() 
{ 
    var sessionUSER=Get_Cookie("Session");
    if (sessionUSER != null)
    {
        sessionUSER = sessionUSER.substring(sessionUSER.indexOf("=")+1, sessionUSER.length);
    }
    else
    {
        sessionUSER = sessionOID;
        Set_Cookie("Session", sessionOID, 30);
    }  
	ServiceUtility.DeleteCompare(sessionUSER, DeleteCompare_Callback);
}
function AddToCompareOne(t) 
{
    var sessionUSER=Get_Cookie("Session");
    if (sessionUSER != null)
    {
        sessionUSER = sessionUSER.substring(sessionUSER.indexOf("=")+1, sessionUSER.length);
    }
    else
    {
        sessionUSER = sessionOID;
        Set_Cookie("Session", sessionOID, 30);
    }    
	ServiceUtility.AddToCompareOne(sessionUSER, t.id.substr(2), AddToCompare_Callback);
}
function showObj(obj)
{
   document.getElementById(obj).className = "vis";
}
function hideObj(obj)
{
   document.getElementById(obj).className = "hid";
}
function showhideObj(obj)
{
   if(document.getElementById(obj).className == "visible")
   { 
       document.getElementById(obj).className = "hidden"; 
       window.onscroll = "";
   }
   else
   { 
       document.getElementById(obj).className = "visible"; 
       scrollObj();
       window.onscroll = scrollObj;
   }
}
function scrollObj()
{
    var div = document.getElementById('divPriceSearch');
	if(div != null) 
	{
		if (!document.documentElement.scrollTop)
		{
			scrollY = document.body.scrollTop;
		}
		else
		{
			scrollY = document.documentElement.scrollTop;
		}
		positionY = (getWindowHeight()-250) / 2; 
		positionX = (getWindowWidth()-677) / 2 + 114;
		div.style.top = scrollY + positionY;
		div.style.right = positionX;
	}
}
function getWindowWidth()
{
	var myWidth = 0;
 	if( typeof( window.innerWidth ) == 'number' ) 	
 	{
    	//Non-IE
   	    myWidth = window.innerWidth;
  	} 
  	else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight)) 
  	{
    	//IE 6+ in 'standards compliant mode'
    	myWidth = document.documentElement.clientWidth;
	} 
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)) 
	{
   	    //IE 4 compatible
    	myWidth = document.body.clientWidth;
  	}
  	return myWidth;
}
function getWindowHeight()
{
	var myHeight = 0;
	if(typeof( window.innerWidth ) == 'number' ) 
	{
	   //Non-IE
	   myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
	   //IE 6+ in 'standards compliant mode'
	   myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	   //IE 4 compatible
	   myHeight = document.body.clientHeight;
	}
	return myHeight;
}
function SearchPriceCount(minValue, maxValue) 
{
    GoodsList.GetPriceCount(minValue, maxValue, SearchPriceCount_Callback);
}
    
function SearchPriceCount_Callback(response) 
{   
    if(response.error != null) 
    {
	    alert(response.error);
	    return;
	}
	
	eval('var result = ' + response.value);
	var obj = document.getElementById(result.id);
	obj.innerHTML = result.GoodsCount;
}
// -->
