function JavaRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function JavaPreload() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=JavaPreload.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function JavaFind(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=JavaFind(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function JavaSwap() { //v3.0
  var i,j=0,x,a=JavaSwap.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=JavaFind(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Cart(target)
{
l=(screen.width-600)/2;
t=(screen.height-500)/2;
window.location.reload();
window.open('shop/addcart.php?idcart='+target+'&count=1&mode=add','','top='+t+', left='+l+', resizable=no, scrollbars=yes, width=600, height=500');
window.focus;

}

function ShowCart(target)
{
l=(screen.width-600)/2;
t=(screen.height-500)/2;
window.open('cart.php','','top='+t+', left='+l+', resizable=no, scrollbars=yes, width=600, height=500');
window.focus;
}

function show_pop(w,h)
{
hide_pop();
yy=getImageY(img_pop);
xx=getImageX(img_pop);
img_popup.style.left=xx-(w/2);
img_popup.style.top=yy-(h/2);
img_popup.style.visibility='visible';
}

function hide_pop()
{
img_popup.style.visibility='hidden';
}

function getImageX(imgElem) {
  xPos = eval(imgElem).offsetLeft;
  tempEl = eval(imgElem).offsetParent;
    while (tempEl != null) {
     xPos += tempEl.offsetLeft;
     tempEl = tempEl.offsetParent;
    }
  return xPos;
}
function getImageY(imgElem) {
   xPos = eval(imgElem).offsetTop;
   tempEl = eval(imgElem).offsetParent;
     while (tempEl != null) {
      xPos += tempEl.offsetTop;
      tempEl = tempEl.offsetParent;
     }
   return xPos;
}

function Public(form)
{
votes=0;
	for (i=0;i<5;i++)
	{
	if (form.vote[i].checked)
		{
		votes=1;
		}
	}
if (votes==0)
	{
	alert("Выставьте, пожалуйста, оценку!");
	return false;
	}
	else if (form.comment.value=="")
		{
		alert("Напишите, пожалуйста, свое мнение о продукте!");
		return false;
		}
		else
		{
		return true;
		}
}

function QA(form)
{
   for (var i=0; i<5; i++) 
   {
     if (form.elements[i].value == "") 
	 { 
       alert ("Поля, отмеченные звездочками обязательны для заполнения"); 
       return false;
     }
  }
  
    
return true;
}


function NewReg()
{
l=(screen.width-320)/2;
t=(screen.height-230)/2;
window.open('reg/reg.php?mode=new','','top='+t+', left='+l+', resizable=no, scrollbars=no, width=320, height=230');
window.focus;
}

function GetN(getname)
{
document.forms["formforum"].f_body.value='<b>'+getname+'</b>, ';
}
