spacer=new Image(); spacer.src="/images/spacer.gif";

bird=new Image(20,21); bird.src="/images/bird.gif";

b_folder_out=new Image(27,18); b_folder_out.src="/images/item_folder.gif";
b_folder_ovr=new Image(27,18); b_folder_ovr.src="/images/item_folder_on.gif";


b_about_out=new Image(145,32); b_about_out.src="/buttons/about.gif";
b_about_ovr=new Image(145,32); b_about_ovr.src="/buttons/about_ovr.gif";

b_service_out=new Image(146,32); b_service_out.src="/buttons/service.gif";
b_service_ovr=new Image(146,32); b_service_ovr.src="/buttons/service_ovr.gif";

b_security_out=new Image(146,32); b_security_out.src="/buttons/security.gif";
b_security_ovr=new Image(146,32); b_security_ovr.src="/buttons/security_ovr.gif";

b_analytic_out=new Image(146,32); b_analytic_out.src="/buttons/analytic.gif";
b_analytic_ovr=new Image(146,32); b_analytic_ovr.src="/buttons/analytic_ovr.gif";

b_contact_out=new Image(145,32); b_contact_out.src="/buttons/contact.gif";
b_contact_ovr=new Image(145,32); b_contact_ovr.src="/buttons/contact_ovr.gif";

var sel_opt;

sel_opt='';

var box_selected='';
var current_selected='1';
var current_second_selected='21';
var current_third_selected='35';
var box1='';
var box2='';
var scroll_body;


function Scroll()
{
 page="/checkout/checkout.php#frm";
 location.href=page;
}

function add_2_cart(url)
{
 window.open(url,'','scrollbars=no,menubar=no,resizable=no,status=no,width=160,height=10,left=0,top=0');
}


function SetPopTip(items,price)
{
// document.all['items'].innerHTML = " : <font color=#003399>"+items+"</font> шт.";
// document.all['price'].innerHTML = " : <font color=#003399>"+price+"</font> р.";
// cart.style.visibility='visible';
// setTimeout("cart.style.visibility='hidden'", 3000);
}

function show_pic(dir,name)
{
    sampWin= open("/show_pics.php3?dir="+dir+"&pic="+name, "displayWindow",
    "width="+10+",height="+10+",status=no,toolbar=no,menubar=no,left=0,top=0,scrollbars=yes");
}

function ColorBox(targetId)
{
  if(current_selected==targetId)
  {

 scroll_body=document.body.scrollTop ;
 var targetElement;
 var x_coords = window.event.x;
 var y_coords = window.event.y + scroll_body;

 tip=ColorTable.style;
 tip.pixelLeft = x_coords+50;
 tip.pixelTop = y_coords-240;

 targetElement = document.getElementById('ColorTable');
 targetElement.style.visibility = "visible";
 box_selected = targetId;

  }
}


function ColorSecondBox(targetId)
{
  if(current_second_selected==targetId)
  {

 scroll_body=document.body.scrollTop ;
 var targetElement;
 var x_coords = window.event.x;
 var y_coords = window.event.y + scroll_body;

 tip=ColorTable2.style;
 if(x_coords<800)
 {tip.pixelLeft = x_coords+30;}
 else
 {tip.pixelLeft = x_coords-165;}


 tip.pixelTop = y_coords-290;

 targetElement = document.getElementById('ColorTable2');
 targetElement.style.visibility = "visible";
 box_selected = targetId;

  }
}

function ColorThirdBox(targetId)
{
  if(current_third_selected==targetId)
  {

 scroll_body=document.body.scrollTop ;
 var targetElement;
 var x_coords = window.event.x;
 var y_coords = window.event.y + scroll_body;

 tip=ColorTable3.style;

 if(x_coords<800)
 {tip.pixelLeft = x_coords+30;}
 else
 {tip.pixelLeft = x_coords-145;}

 tip.pixelTop = y_coords-100;

 targetElement = document.getElementById('ColorTable3');
 targetElement.style.visibility = "visible";
 box_selected = targetId;

  }
}


function StoreColor()
{
  //alert(box_selected);
  targetElement = document.getElementById("box"+box_selected);
  eval('form1.box_'+box_selected).value = targetElement.style.background;
  ColorTable.style.visibility = 'hidden';
  current_selected++;


  next = box_selected+1;
  if(next<21){
   targetElement_ = document.getElementById("box"+next);
   targetElement_.style.background = "#f6f6f6";
  }
  else
  {
   if(next==21)
   {

    Mark("chromo1_title");
    targetElement = document.getElementById('chromo2');
    targetElement.style.display = "";

   }
  }

}

function StoreColorSecond(n)
{
  //alert(box_selected);
//  if(n=='')

//  eval('form1.box_'+box_selected).innerTEXT = 'a';



  //alert(box_selected);
  targetElement = document.getElementById("box"+box_selected);
  eval('form1.box_'+box_selected).value = targetElement.style.background;
  ColorTable2.style.visibility = 'hidden';
  current_second_selected++;
  next = box_selected+1;


  if(n=='x')
  {
   document.all["box"+box_selected].innerHTML = 'x';
   eval('form1.box_'+box_selected).value = 'x';
  }


  if(next<35){
  targetElement_ = document.getElementById("box"+next);
  targetElement_.style.background = "#f6f6f6";
  }
  else
  {

   if(next==35)
   {

    Mark("chromo2_title");
    targetElement = document.getElementById('chromo3');
    targetElement.style.display = "";

   }


  }
}


function StoreColorThird()
{
  //alert(box_selected);
  targetElement = document.getElementById("box"+box_selected);
  eval('form1.box_'+box_selected).value = targetElement.style.background;
  ColorTable3.style.visibility = 'hidden';
  current_third_selected++;


  next = box_selected+1;
  if(next<49){
  targetElement_ = document.getElementById("box"+next);
  targetElement_.style.background = "#f6f6f6";
  }
  else
  {
   if(next==49)
   {

    Mark("chromo3_title");
//    targetElement = document.getElementById('chromo2');
//    targetElement.style.display = "";

   }
  }


}



function TargetColor(color)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background=color;
}


function TargetColorYellow(targetId)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background="#fffc00";
}
function TargetColorYellow(targetId)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background="#fffc00";
}
function TargetColorRed(targetId)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background="#ff0000";
}
function TargetColorWhite(targetId)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background="#ffffff";
}
function TargetColorOrange(targetId)
{
  targetElement = document.getElementById("box"+box_selected);
  targetElement.style.background="#ff9c00";
}



function UnColorBox()
{
  targetElement = document.getElementById("box"+box_selected);
  if(eval("form1.box_"+box_selected).value=='')
   {
     targetElement.style.background="#cccccc";
   }
}


function TargetBox(targetId)
{
  if(current_selected==targetId)
  {
   targetElement = document.getElementById("box"+targetId);
   targetElement.style.background="#cccccc";
  }
}

function TargetSecondBox(targetId)
{
  if(current_second_selected==targetId)
  {
   targetElement = document.getElementById("box"+targetId);
   targetElement.style.background="#cccccc";
  }
}

function UnTargetSecondBox(targetId)
{
  if(current_second_selected==targetId)
  {

  targetElement = document.getElementById("box"+targetId);
  if(ColorTable2.style.visibility != "visible")
  {
   targetElement.style.background="#f6f6f6";
  }

  }
}


function TargetThirdBox(targetId)
{
  if(current_third_selected==targetId)
  {
   targetElement = document.getElementById("box"+targetId);
   targetElement.style.background="#cccccc";
  }
}

function UnTargetThirdBox(targetId)
{
  if(current_third_selected==targetId)
  {

  targetElement = document.getElementById("box"+targetId);
  if(ColorTable3.style.visibility != "visible")
  {
   targetElement.style.background="#f6f6f6";
  }

  }
}


function UnTargetBox(targetId)
{
  if(current_selected==targetId)
  {

  targetElement = document.getElementById("box"+targetId);
  if(ColorTable2.style.visibility != "visible")
  {
   targetElement.style.background="#f6f6f6";
  }

  }
}


function ShowMap()
{

  sampWin= open("", "displayWindow",
    "width="+600+",height="+450+",status=no,toolbar=no,menubar=no,left=0,top=0");
  sampWin.document.open();
  sampWin.document.write("<html><head><title></title>");
  sampWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'></head><body BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onblur='close()'>");
  sampWin.document.write("<img src=/images/map_big.gif width=600 height=450>");
  sampWin.document.write("</body></html>");
  sampWin.document.close();
}


function ShowMap1()
{

  sampWin= open("", "displayWindow",
    "width="+384+",height="+451+",status=no,toolbar=no,menubar=no,left=0,top=0");
  sampWin.document.open();
  sampWin.document.write("<html><head><title></title>");
  sampWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'></head><body BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onblur='close()'>");
  sampWin.document.write("<img src=/images/map1.gif>");
  sampWin.document.write("</body></html>");
  sampWin.document.close();
}


function SendQuest()
{

   words="Ваш вопрос отправлен";

  sampWin= open("", "displayWindow",
    "width="+400+",height="+150+",status=no,toolbar=no,menubar=no,left=0,top=0");
  sampWin.document.open();
  sampWin.document.write("<html><head><title></title>");
  sampWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'></head><body BGCOLOR=#FFFFFF LEFTMARGIN=20 TOPMARGIN=20 MARGINWIDTH=0 MARGINHEIGHT=0 onblur='close()'>");
  sampWin.document.write("<font face=Georgia>"+words+"</font>");
  sampWin.document.write("</body></html>");
  sampWin.document.close();
}

function SendArticle()
{
  if(client_mail.value=="")
  {
   words = "Не указан email";
  }
  else
  {
   words="статья отправлена ("+client_mail.value+")";
  }
  sampWin= open("", "displayWindow",
    "width="+400+",height="+150+",status=no,toolbar=no,menubar=no,left=0,top=0");
  sampWin.document.open();
  sampWin.document.write("<html><head><title></title>");
  sampWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'></head><body BGCOLOR=#FFFFFF LEFTMARGIN=20 TOPMARGIN=20 MARGINWIDTH=0 MARGINHEIGHT=0 onblur='close()'>");
  sampWin.document.write("<font face=Georgia>"+words+"</font>");
  sampWin.document.write("</body></html>");
  sampWin.document.close();
}

function show_help(targetId)
{
var targetElement;
       targetElement = document.getElementById(targetId);
       targetElement_ = document.getElementById(targetId+"_");

if (targetElement.style.display == "none")
{
 targetElement.style.display = "";
 targetElement_.style.color = "#A40000";

 if(sel_opt!='' && sel_opt!=targetElement)
 {
   sel_opt.style.display='none';
   sel_opt_.style.color = "";
 }
 sel_opt=targetElement;
 sel_opt_ =targetElement_;
}
else
{
 targetElement.style.display = "none";
 targetElement_.style.color = "";
}
}









function show_help_for(targetId,num)
{
var targetElement;

 var k;
 k=1;

for(i=1;i<num+1;i++)
{
 targetElement = document.getElementById(targetId+i);


 if (targetElement.style.display == "none")
 {
  if(k==1)
  {
   document[targetId+"_b"].src=eval("b_folder_out.src");
   k=0;
  }
  targetElement.style.display = "";
 }
 else
 {
//  alert(eval("b_folder_ovr.src"));
  if(k==1)
  {
    document[targetId+"_b"].src=eval("b_folder_ovr.src");
    k=0;
  }

  targetElement.style.display = "none";
 }
}

}








    function Point(arg) {

      eval("document."+arg).Play();

  //      document.all[arg.Play();
       document.location.replace("#"+arg);
      //  return false;

    }

    function GoUp()
    {
     scroll(0,0);
    }



function Hide_sub(targetId)
{
var targetElement;
       targetElement = document.getElementById(targetId);
 targetElement.style.display = "none";
}

function Show_sub(targetId)
{
var targetElement;
       targetElement = document.getElementById(targetId);
 targetElement.style.display = "";
}

function Movr(imageName){
if(document.images){
     document[imageName].src=eval(imageName + "_ovr.src");
}}
function Mout(imageName){
 if(document.images){
     document[imageName].src=eval(imageName+"_out.src");
}}

function Mark(imageName){
 if(document.images){
     document[imageName].src=eval("bird.src");

     targetElement = document.getElementById(imageName+"_");
     targetElement.style.color = "#168600";

}}

function UnMark(imageName){
 if(document.images){
     document[imageName].src=eval("spacer.src");

     targetElement = document.getElementById(imageName+"_");
     targetElement.style.color = "";

}}



var LinkDivActive = 0;
var onDiv='about';
var timeOnDiv;
var layerRef;
var styleRef;
var showVar;
var hideVar;

if (navigator.appName == "Netscape") {
 layerRef="document.";
 styleRef="";
 showVar="'show'";
 hideVar="'hide'";
} else {
 layerRef="document.all.";
 styleRef=".style";
 showVar="'visible'";
 hideVar="'hidden'";
}

//Divisions Show | Hide
function hideDiv(divn) {
  Mout('b_' + onDiv);
 eval(layerRef+divn+styleRef+'.visibility = '+hideVar);
}

function showDiv(divn) {
 eval(layerRef+divn+styleRef+'.visibility = '+showVar);
}

//Link Divisions Stuff
function showLinkDiv(divn) {
 if (timeOnDiv != null) {
  clearTimeout(timeOnDiv);
  hideDiv(onDiv);
 }
 showDiv(divn);
 onDiv = divn;
}

function divTimer() {
 timeOnDiv = setTimeout("divOut()",500)
}

function divOut() {
 if (LinkDivActive == 0) {
  hideDiv(onDiv);
 }
}

function LinkDivOver() {
 LinkDivActive = 1;
 clearTimeout(timeOnDiv);
}

function LinkDivOut() {
 LinkDivActive = 0;
 timeOnDiv = setTimeout("divOut()",500)
}

function Drag()
{
 menu1 = catalog.style;
 menu2 = client.style;

 var a=document.body.clientWidth;
 if(a<841){a=841;};
 a=a/2;
 menu1.pixelLeft=a+38;
 menu2.pixelLeft=a+155;
}


function showbigmap()
{
  sampWin= open("", "displayWindow",
    "width="+400+",height="+391+",status=no,toolbar=no,menubar=no,left=0,top=0");
  sampWin.document.open();
  sampWin.document.write("<html><head><title>Карта проезда</title>");
  sampWin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'></head><body BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>");
  sampWin.document.write("<img src='../images/map_onlyway.gif' border=0 width=400 height=391>");
  sampWin.document.write("</body></html>");
  sampWin.document.close();
}


var scroll_body;



function settip(text)
{
 scroll_body=document.body.scrollTop ;
// var scroll_body=0;
 smallTip.style.visibility='visible';
// txt = "<table high=15 width=140 border=1 cellspacing=0 cellpadding=0 bordercolor=#006600 bordercolordark=#000000 bgcolor=#000000><tr><td align=center  background=/images/tip/up_bg.gif> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9></td></tr></table><table high=15 width=140 border=1 cellspacing=0 cellpadding=0 bordercolor=#006600 bordercolordark=#000000 bgcolor=#000000><tr><td align=center> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9></td></tr></table><table high=15 width=140 border=1 cellspacing=0 cellpadding=0 bordercolor=#006600 bordercolordark=#000000 bgcolor=#000000><tr><td align=center> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9> <IMG SRC='/images/tip/tip_03.gif' WIDTH=11 HEIGHT=9></td></tr></table>"
// document.all['small_tip_text'].innerHTML = text;
 document.all['tip_text'].innerHTML = text;
}

function HideTip()
{
 document.all['smallTip'].style.visibility='hidden';
}

function HideColTip()
{
 document.all['colTip'].style.visibility='hidden';
}

function move()
{

  var x_coords = window.event.x;
//  if(x_coords>1000){x_coords=1000;}
  tip=smallTip.style;
  tip.pixelLeft = document.body.scrollLeft+x_coords-50;
  tip.pixelTop = window.event.y+scroll_body+20;
}


function CheckSixBlock()
{
  if(
  form1.recomend.value !='' &&
  form1.consult.value !='' &&
  form1.phone.value !='' &&
  form1.email.value !=''
  )
  {
   Mark("contacts_title");
   targetElement = document.getElementById('chromo1');
   targetElement.style.display = "";
  }
  else
  {
   UnMark("contacts_title");
  }
}

function CheckFifthBlock()
{

 chronic_disease_='';
 health_='';

 chronic_disease = document.getElementById('chronic_disease_sub');
 if(chronic_disease.style.display=='none' && form1.chronic_disease[1].checked==true)
 {
   chronic_disease_ = 'ok';
 }
 else
 {
   if(form1.chronic_disease_list.value!='')
      {
         chronic_disease_ = 'ok';
      }
 }


 hhealth = document.getElementById('hhealth_sub');

 if(hhealth.style.display=='none' && form1.health_problem[1].checked==true)
 {
   health_ = 'ok';
 }
 else
 {
   if(form1.health_list.value!='')
      {
         health_ = 'ok';
      }
 }


 if(
     chronic_disease_ == 'ok' &&
     health_ == 'ok'
     )
 {
  Mark("health_title");
  targetElement = document.getElementById('contacts');
  targetElement.style.display = "";
 }
 else
 {
  UnMark("health_title");
 }

}

function CheckFourthBlock()
{
  if(
  form1.color_like.value!='' &&
  form1.color_notlike.value!='' &&
  form1.stone_like.value!='' &&
  form1.metall_like.value!='' &&
  form1.flower_like.value!=''
  )
  {
    Mark("likes_title");
    targetElement = document.getElementById('health');
    targetElement.style.display = "";
  }
  else
  {
     UnMark("likes_title");
  }
}

function CheckThirdBlock()
{
 if(
   form1.problem.value !='' &&
   form1.work.value !=''
   )
   {
    Mark("problems_title");
    targetElement = document.getElementById('likes');
    targetElement.style.display = "";
   }
   else
   {
     UnMark("problems_title");
   }
}

function CheckSecondBlock()
{

if(
form1.mother_day.value != 0 &&
form1.mother_month.value != 0 &&
form1.mother_year.value !='' &&
form1.mother_family.value !='' &&
form1.mother_name.value !='' &&
form1.mother_middlename.value !='' &&
form1.father_day.value != 0 &&
form1.father_month.value != 0 &&
form1.father_year.value !='' &&
form1.father_family.value !='' &&
form1.father_name.value !='' &&
form1.father_middlename.value !='')
{

  Mark("parents_title");
  targetElement = document.getElementById('problems');
  targetElement.style.display = "";

}
else
{
  UnMark("parents_title");
}




}

function CheckFirstBlock()
{
 change_family_='';
 change_name_='';
 change_middlename_='';

 change_family = document.getElementById('family_sub');
 if(change_family.style.display=='none' && form1.change_family[1].checked==true)
 {
   change_family_ = 'ok';
 }
 else
 {
   if(form1.family_change_day.value!=0 &&
      form1.family_change_month.value!=0 &&
      form1.family_change_year.value!='' &&
      form1.family_change_reason.value!='' &&
      form1.new_family.value!='' )
      {
         change_family_ = 'ok';
      }
 }


 change_name = document.getElementById('name_sub');
 if(change_name.style.display=='none' && form1.change_name[1].checked==true)
 {
   change_name_ = 'ok';
 }
 else
 {
   if(form1.name_change_day.value!=0 &&
      form1.name_change_month.value!=0 &&
      form1.name_change_year.value!='' &&
      form1.name_change_reason.value!='' &&
      form1.new_name.value!='')
      {
         change_name_ = 'ok';
      }
 }



 change_middlename = document.getElementById('middlename_sub');
 if(change_middlename.style.display=='none' && form1.change_middlename[1].checked==true)
 {
   change_middlename_ = 'ok';
 }
 else
 {
   if(form1.middlename_change_day.value!=0 &&
      form1.middlename_change_month.value!=0 &&
      form1.middlename_change_year.value!='' &&
      form1.middlename_change_reason.value!='' &&
      form1.new_middlename.value!='')
      {
         change_middlename_ = 'ok';
      }
 }

 //alert(form1.day.value);

 if(
     form1.day.value !=0 &&
     form1.month.value !=0 &&
     form1.year.value !='' &&
     form1.family.value !='' &&
     form1.name.value !='' &&
     form1.middlename.value !='' &&
     change_family_ == 'ok' &&
     change_name_ == 'ok' &&
     change_middlename_ == 'ok'
     )
 {
  Mark("about_title");
  targetElement = document.getElementById('parents');
  targetElement.style.display = "";
 }
 else
 {
  UnMark("about_title");
 }

}



function ShowSample(doc,size)
{
 page="/catalog/samples/"+doc+".html";
 window.open(page,'','scrollbars=yes,resizable=no,menubar=yes,width='+size+',height=500,left=0,top=0');
}
