function preload()
{
if (document.images)
{ 
var imgsrc = preload.arguments;
arr=new Array(imgsrc.length);
for (var j=0; j<imgsrc.length; j++)
{ arr[j] = new Image; arr[j].src = imgsrc[j]; }
}
} 

  function clean()
   {
   document.form.find.value=" ";
   }
   
function popUpPage(url, parameters, name)
{
	var day = new Date();
	var pageName = name ? name : day.getTime()

	eval("jd"+pageName+" = window.open('"+url+"','"+pageName+"','"+parameters+"')");

	if (eval("jd"+pageName) && window.focus) eval("jd"+pageName).focus();
}
function check(obj)
{
    if ( obj.from_name.value =='' || obj.phone.value =='' || obj.email.value =='')
    {
        alert( "Заполните пожалуйста поле с отметкой (*).\nБудте внимательны!!!" );

        return false;
    }

    obj.submit();
}	
function check_pass(obj)
{
    if ( obj.log.value == '' ||  obj.pas.value == '')
    {
        alert( "Введите свой логин и пароль.\nБудте внимательны!!!" );
        return false;
    }
    obj.submit();
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
isShow = readCookie('is_show');
if(isShow == null) {isShow = 'false';}


var today = new Date();
var expire = new Date();
function basketInit()
{	  
	obj = document.getElementById('compareon')	
 if (document.getElementById('compareon'))
 {
	if (isShow=='true') {
		document.getElementById('compare_content').style.display=''
		obj.src ='pic/arrow_down.gif'
		obj.title ='Скрыть просмотренные позиции'
		document.getElementById('content').style.bottom =90
	}else {
		document.getElementById('compare_content').style.display='none'
		obj.src ='pic/arrow_up.gif'	
		obj.title ='Показать просмотренные позиции'
		document.getElementById('content').style.bottom = 30
	}
	writeCookie('is_show', isShow, 3600*24*30*365);
 }
}

function basketShow(show)
{
	if (isShow==true) { switch_index=1; } else { switch_index=0;}
	if (show==1) switch_index=0;
	if (show==0) switch_index=1;
	obj = document.getElementById('compareon')
	if (switch_index==1) {
		document.getElementById('compare_content').style.display='none'
		obj.src ='pic/arrow_up.gif'	  
		obj.title ='Показать просмотренные позиции'
		isShow = false
	document.getElementById('content').style.bottom = 30
	}else {
		document.getElementById('compare_content').style.display=''
		obj.src ='pic/arrow_down.gif' 
		obj.title ='Скрыть просмотренные позиции'
		isShow = true
	document.getElementById('content').style.bottom =90
	}
	writeCookie('is_show', isShow, 3600*24*30*365);
}



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 writeCookie (cookieName, cookieValue, expiry) 
{
var expDate = new Date();
	if(expiry){
		expDate.setTime (expDate.getTime() + expiry);
		document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/;";
	}
	else{
		document.cookie = cookieName + "=" + escape (cookieValue);
	}
}

function del (cookieName) 
{
	document.cookie = cookieName + "= 0; expires=-1; path=/;";
}


