 function isValidEmail (email, strict)
 {
 // если надо проверять пробелы до и после адреса то передавать true
  if ( !strict ) email = email.replace(/^\s+|\s+$/g, '');
  return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
 }
 function _Check1(){
    if ((document.forms1.name.value != '') && (document.forms1.message.value != '') && (document.forms1.email.value != '') && (document.forms1.code.value != '')) {

      if(!isValidEmail(document.forms1.email.value)) {
         alert("Неверный формат e-mail");
         return false;
      }
      return true;
    }
    else {
       alert('Вы не заполнили обязательные поля!');
       return false;
    }

 }

 function calc(){
    sum=0;
/*
    sm = new Array();
    sm[1]=100;
    sm[2]=200;
    sm[3]=300;
    sm[4]=400;
    sm[5]=500;
    sm[6]=600;
    sm[7]=700;
    sm[8]=800;
    sm[9]=900;
    sm[10]=1000;
*/
	 for (i = 1; i <= 10; i++) {
       id='c'+i;
       if (document.getElementById(id).checked==true) sum=sum+(document.getElementById(id).value*1);// sum=sum+sm[i];
    }
    document.getElementById('totalsum').innerHTML=sum+" $";
 }


/*-------------------------------------------------------------*/
//  Вывод увеличенной фотки с затемнением контента
 var zInd = 1001;
 var indshow=false;
 var ii = 1;
 var wi,hi,ww,cw,ch;

 function showfoto(w,h,img){
   var ua = navigator.userAgent.toLowerCase();
   var isOpera = (ua.indexOf('opera')  > -1);
   var isIE = (!isOpera && ua.indexOf('msie') > -1);

   function getDocumentHeight() {
     return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollHeight : document.documentElement.scrollHeight, getViewportHeight());
   }
   function getViewportHeight() {
     return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientHeight : document.body.clientHeight : (document.parentWindow || document.defaultView).innerHeight;
   }

   function getDocumentWidth() {
     return Math.max(document.compatMode != 'CSS1Compat' ? document.body.scrollWidth : document.documentElement.scrollWidth, getViewportWidth());
	}
	function getViewportWidth() {
	  return ((document.compatMode || isIE) && !isOpera) ? (document.compatMode == 'CSS1Compat') ? document.documentElement.clientWidth : document.body.clientWidth : (document.parentWindow || document.defaultView).innerWidth;
	}

   centerh=document.documentElement.scrollTop+(getViewportHeight()/2);
   centerw=document.documentElement.scrollWidth/2;
	document.getElementById('fbcl').style.height=getDocumentHeight()+"px";
	document.getElementById('fbcl').style.width=getDocumentWidth()+"px";
	document.getElementById('fbcl').style.visibility="visible";

   ww=w;

    if (indshow==true) cls();
    content1="<div id='v2' class='v2'><table width='"+(w+14)+"' cellpadding='0' cellspacing='0'><tr><td class='vf1'></td><td class='vf2' width='"+w+"'></td><td class='vf3'></td></tr><tr><td class='vf4'></td><td valign='top' height='"+(h-6)+"' class='vf4a'></td><td class='vf5'></td></tr><tr><td class='vf6'></td><td class='vf7' width='"+w+"'></td><td class='vf8'></td></tr></table><div id='v2a' class='v2a' align='right'><img onClick='cls()' style='cursor:pointer;margin:10px 10px 0 0' src='img/close.png'></div><div id='fbcl1'><img src='/img/loading.gif'></div></div><img onload='imgvs()' id='imgf' class='imgf' style='margin:7px' src='image.php?foto="+img+"&type=3'>";

/*
<div id='v2b' class='v2b' align='right' style='top:"+(h-20)+"px;' ><img onClick='cls()' style='cursor:pointer;margin:0 10px 0px 0;' src='img/close.png'></div>
*/
    var div = document.createElement('div');
    id='showfoto';
    div.id=id;
    div.className='v1';
    zInd+=1;
    div.style.zIndex=zInd;
    document.body.appendChild(div);
    document.getElementById(id).innerHTML=content1;

	document.getElementById('fbcl1').style.top=(h/2)-10+"px";
	document.getElementById('fbcl1').style.left=(w/2)+"px";

	document.getElementById('showfoto').style.top=centerh-(h/2)+"px";
	document.getElementById('showfoto').style.left=centerw-(w/2)+"px";
    indshow=true;

    ii=5;
//    wi=document.getElementById('imgf').width;
//    document.getElementById('imgf').width=wi/10;
//    setTimeout("time()",30);
 }
 function imgvs(){
    document.getElementById('fbcl1').style.visibility='hidden';
/*
    cw=document.getElementById('imgf').width;
    ch=document.getElementById('imgf').height;
    cw=cw/2;
    ch=ch/2;

    hi=document.getElementById('imgf').height;
    wi=document.getElementById('imgf').width;
    document.getElementById('imgf').width=wi/10;

    document.getElementById('imgf').style.left=cw-((wi/10)/2);
    document.getElementById('imgf').style.top=ch-((hi/10)/2);
*/
    document.getElementById('imgf').style.visibility='visible';

//    wi=document.getElementById('imgf').width;
//    document.getElementById('imgf').width=wi/10;
    setTimeout("time()",10);
//    setTimeout("document.getElementById('imgf').style.visibility='visible'",1000);
//   document.getElementById('v2a').style.visibility='visible';
 }
 function cls(){
    document.body.removeChild(document.getElementById('showfoto'));
	document.getElementById('fbcl').style.visibility="hidden";
    indshow=false;
 }
 function time(){
   if (ii>0){
//      document.getElementById('imgf').width=(wi/10)*ii;
      document.getElementById('imgf').style.opacity=1/ii;
      document.getElementById('imgf').style.filter='alpha(opacity='+(100/ii)+')';

//        document.getElementById('imgf').style.left=cw-(((wi/10)*ii)/2);
//        document.getElementById('imgf').style.top=ch-(((wi/10)*ii)/2);
      setTimeout("time()",60);
      ii=ii-1;
   }
   else{
//      document.getElementById('v2').style.visibility='visible';
      document.getElementById('v2a').style.visibility='visible';
      document.getElementById('v2a').style.left=(ww-35)+"px";
   }
 }
//-----------------------------------------------------//



