function checkEmail(obj)
{
	
    var str=obj.value;
    if(str=='') return true;
    if (/^([\w-~_]+\.)*[\w-~_]+@([\w-_]+\.){1,3}\w{2,4}$/.test(str))	return true;

alert("Неправильный e-mail адрес");
obj.focus();
return false;
}

function zoom(name,format)
{
        var p=window.open('/zoom.plx?n='+name+'&amp;f='+format,'preview_window',"width=10,height=10,top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
	return false;
}

function zoomPF(file)
{
        var p=window.open('/zoomPF.plx?id='+file,'preview_window',"width=10,height=10,top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
	return false;
}

function zoomPR(file)
{
        var p=window.open('/zoomPR.plx?id='+file,'preview_window',"width=10,height=10,top=0,left=0,location=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,fullscreen=0");
        if(p)p.focus();
	return false;
}

function doBk(iid,section,price)
{
  var obj,img;
  if(!isInBk(iid))
  {
    var cnt=document.getElementById("cnt_"+iid);
    var icnt=1;
    if(cnt)
    {    
       icnt=parseInt(cnt.value)+0;
       if(icnt<=0 || isNaN(icnt)){icnt=1;}
    }
    addToBk(iid+'_'+icnt);
    var noteBK=document.getElementById("noteBK");
    var noteMN=document.getElementById("noteMN");
    var count=parseInt(cookieVal("noteCount"))+icnt;
    var money=parseFloat(cookieVal("moneyCount"));
    if (!money) {money=0;}
    money=money+parseFloat(price)*icnt;
    if(noteBK)
    {
       var ender='ов';
       if(count<5) ender='a';
       if(count==1) ender='';
       noteBK.innerHTML=count+' товар'+ender;
    }
    if(noteMN){noteMN.innerHTML=money;}
    document.cookie ="noteCount="+count+"; path=/;";
    document.cookie ="moneyCount="+money+"; path=/;";
  }
  var buttonBK=document.getElementById("buttonBK_"+iid);
  if(buttonBK){buttonBK.innerHTML='заказано';}
  return false;
}

function dropBk()
{
 var obj=document.getElementById("my_note");
 obj.style.display='none';
}

function cookieVal(cookieName)
{
    thisCookie = document.cookie.split("; ")
        for (i = 0; i < thisCookie.length; i++) {
            if (cookieName == thisCookie[i].split("=")[0]) {
                return thisCookie[i].split("=")[1];
            }
        }
    return 0;
}

function isInBk(posNum)
{
    var p_cookie=document.cookie;
    var cookie;
    cookie=unescape(p_cookie.substr(p_cookie.indexOf('book=')+5,p_cookie.indexOf('-NSB')-p_cookie.indexOf('book=')-4));
    return cookie.indexOf('-'+posNum+'_')==-1?false:true;
}

function addToBk(code)
{
  var p_cookie=document.cookie;
  var cookie;
  cookie=unescape(p_cookie.substr(p_cookie.indexOf('book=')+5,p_cookie.indexOf('-NSB')-p_cookie.indexOf('book=')-5));
  p_cookie='book='+escape(cookie+'-'+code)+'-NSB; path=/;';
  document.cookie=p_cookie;
}

function itemGroup(f)
{
   var obj=document.getElementById(f);
   var id = obj.elements[0].options[obj.elements[0].selectedIndex].value;
   document.location.href=obj.action+'/&ig='+id;
}