var xmlHttp
var ttime
ttime=2
function showHint(str)
{
//document.write(str)
if (str.length==0)
  { 
  document.getElementById("aaa").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

if (str==0)
  {
  alert ("בחר יצרן");
  return;
  } 

var url="gethint1.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
//document.write(url)
xmlHttp.onreadystatechange=stateChange;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showcampaign(str,str2,str3)
{

str=str+1
if (str>str3)
str=1


//document.write(str)
if (str.length==0)
  { 
  document.getElementById("campaign").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

if (str==0)
  {
  alert ("בחר יצרן");
  return;
  } 

var url="campaign2.asp";
url=url+"?currentpage="+str+"&codeproduct="+str2;
url=url+"&sid="+Math.random();
//document.write(url)
xmlHttp.onreadystatechange=stateChangecampaign;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
setTimeout("showcampaign("+str+","+str2+","+str3+")",5000);
}







function addbasket(str,str1)
{

if (str.length==0)
  { 
  document.getElementById("basket").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var a,b,c,d,e
d=0;
e=0;
a=document.getElementById(''+str)
if (a)
{
b=document.getElementById(''+str).value

c=document.getElementById('pricemarket'+str);
//document.write()
if (c)
{
//document.write(c)
if (document.getElementById('pricemarket'+str).checked==true)
{d=1;
e=1}
}
c=document.getElementById('priceweb'+str);
if (c)
{
//document.write(c)
if (document.getElementById('priceweb'+str).checked==true)
{d=2;
e=1}
}
c=document.getElementById('pricecampaign'+str);
if (c)
{
//document.write(c)
if (document.getElementById('pricecampaign'+str).checked==true)
{d=3;
e=1}
}
}
else
b=1;
if (e==0 && str1==2)
alert('בחר סוג והוסף לסל')
else
{
//document.write(d)
var url="addproduct2.asp";
url=url+"?q="+str+"&q2="+str1+"&num="+b+"&whichprice="+d;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=updatebasket;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
}



function addbasketcampaign(str,str1)
{

if (str.length==0)
  { 
  document.getElementById("basket").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var a,b
b=1;
//document.write(d)
var url="addproduct2.asp";
url=url+"?q="+str+"&q2="+str1+"&num="+b+"&whichprice="+1;
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=updatebasket;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

























function deletep(str,str1)
{

if (str.length==0)
  { 
  document.getElementById("basket").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="deletepr.asp";
url=url+"?q="+str+"&q2="+str1;
url=url+"&sid="+Math.random();
//document.write(url)
xmlHttp.onreadystatechange=updatebasket;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function deleteporder(str,str1)
{

if (str.length==0)
  { 
  document.getElementById("basket").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="deleteprorder2.asp";
url=url+"?q="+str+"&q2="+str1;
url=url+"&sid="+Math.random();
//document.write(url)
xmlHttp.onreadystatechange=updatebasketorder2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}

function deleteporder2()
{

//if (str.length==0)
  //{ 
  //document.getElementById("basket").innerHtml="";
  //return;
  //}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="deleteprorder2.asp";
//url=url+"?q="+str+"&q2="+str1;
url=url+"?sid="+Math.random();
//document.write(url)
xmlHttp.onreadystatechange=updatebasketorder2;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}


function showdelivery(str,str1)
{

if (str.length==0)
  { 
  document.getElementById("delivery3").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="delivery.asp";
url=url+"?q="+str+"&q1="+str1;

url=url+"&sid="+Math.random();

//document.write(url)
xmlHttp.onreadystatechange=delivery1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function showdeliveryorder(str)
{

if (str.length==0)
  { 
  document.getElementById("delivery3").innerHtml="";
  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 

var url="deliveryorder.asp";
url=url+"?q="+str;

url=url+"&sid="+Math.random();

//document.write(url)
xmlHttp.onreadystatechange=delivery1;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}











function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}



function stateChange() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("pres").innerHTML=xmlHttp.responseText;
}
}
function stateChangecampaign() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("campaign").innerHTML=xmlHttp.responseText;
}

}


function updatebasket() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("basket").innerHTML=xmlHttp.responseText;
}
}

function updatebasketorder() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("basket").innerHTML=xmlHttp.responseText;
deleteporder2();
//document.getElementById("basketorder").innerHTML=xmlHttp.responseText;
}
}

function updatebasketorder2() 
{ 
if (xmlHttp.readyState==4)
{ 
//document.getElementById("basket").innerHTML=xmlHttp.responseText;
document.getElementById("basketorder").innerHTML=xmlHttp.responseText;
//updateprice()

}
document.getElementById("totalprice2").innerHTML=document.getElementById("totalprice").innerHTML;
}

function abcd(a)
{
var c,b

c=document.getElementById("totalprice2").innerHTML;
//document.write(c);
b=c/a;
document.getElementById("totalprice3").innerHTML=''+b;
}

function delivery1() 
{
 
if (xmlHttp.readyState==4)
{ 
//document.write("sdfgsdfgs44")
document.getElementById("delivery3").innerHTML=xmlHttp.responseText;
}
}



function coastdelivery(str)
{

var a,b
 //document.write(str)
  document.getElementById("co1").innerHTML='  עלות משלוח: '+str+' ש"ח';
//document.getElementById("totalprice").innerHTML=document.getElementById("totalprice").innerHTML+str;
  a=document.getElementById(str).value;
//b="a"+str
document.getElementById("co2").innerHTML='  זמן הספקה: '+a;
}


 function showDivform3side(d_id)
 {
  d_id.style.display = d_id.style.display == "none" ? "" : "none"

  
 }

function coastdelivery2(str)
{

var a,b,c
 //document.write(str)
  document.getElementById("co1").innerHTML='  עלות משלוח: '+str+' ש"ח';
c=document.getElementById("totalprice").innerHTML/1+str/1;
document.getElementById("totalprice2").innerHTML=c
  a=document.getElementById(str).value;
//b="a"+str
document.getElementById("co2").innerHTML='  זמן הספקה: '+a;
}


 function showDivform3side(d_id)
 {
  d_id.style.display = d_id.style.display == "none" ? "" : "none"

  
 }

    
 function confirmdel(a,b)
 {
if (b=='0')
{
var r=confirm("האם אתה בטוח שברצונך למחוק את הקטגוריה")
  if (r==true)
    {
    window.location="index_menu.asp?cat="+a+"&del=delete"
    
    }
  else
    {
    alert("You pressed OK!")
    }


}

if(b=='1')
{
alert("קטגוריה זו לא ניתנת למחיקה, יש תחילה למחוק את תתי הקטגוריות השייכות לקטגוריה זו")
}
  
 }


     



     function changeimage(im)
     {
    im1 = ("" + im);
     document.b1.src =im1
document.b11.href=im1
     
     }
     
           

 function showDiv(d_id)
 {
  d_id.style.display = d_id.style.display == "none" ? "" : "none"
 }



function check1(cur)
{
return validity;

}

function newwin(URL)
 {
newWindow = window.open(URL, "myNewWindow", "toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=1, resizable=0, width=650, height=450, left=100, top=100")

 }


function check_search(which){
if (which.search1.value!=""){

return true
}
else
alert("עליך להקליד מילת חיפוש")

return false
}

function showOrHide(value,a,b) {
    if (value==0) {
        if (document.layers)
           document.layers["layer"].visibility='hide';
        else
           document.all["layer"].style.visibility='hidden';
   }
   else if (value==1) {

       if (document.layers)
          {document.layers["layer"].visibility='show';
document.image.src=''+a;
document.image.alt=''+b;
}
       else
         { document.all["layer"].style.visibility='visible';
document.image.src=''+a;
document.image.alt=''+b;
}
   }
}

function coordinates(event,a,image,name)
{
x=event.x+100
y=event.y
document.all["layer"].style.left=x;
document.all["layer"].style.top=y;
showOrHide(1,image,name);

}
 function showDivform4(d_id)
 {
  d_id.style.display = d_id.style.display == "none" ? "" : "none"

  
 }


 function qm(d_id)
 {
// var a,b,c
  document.getElementById(''+d_id).value ++;
//a= ;
//b=document.getElementById('pricemarket').innerHTML;
//c=a*b;
//var a,b,c

if (document.getElementById('hp1'+d_id))
  document.getElementById('p1'+d_id).innerHTML=document.getElementById('hp1'+d_id).value*document.getElementById(''+d_id).value;
if (document.getElementById('hp2'+d_id))
document.getElementById('p2'+d_id).innerHTML=document.getElementById('hp2'+d_id).value*document.getElementById(''+d_id).value;
if (document.getElementById('hp3'+d_id))
document.getElementById('p3'+d_id).innerHTML=document.getElementById('hp3'+d_id).value*document.getElementById(''+d_id).value
 }


 function ql(d_id)
 {
 if (document.getElementById(''+d_id).value > 1) 
 { document.getElementById(''+d_id).value --

if (document.getElementById('hp1'+d_id))
  document.getElementById('p1'+d_id).innerHTML=document.getElementById('hp1'+d_id).value*document.getElementById(''+d_id).value;
if (document.getElementById('hp2'+d_id))
document.getElementById('p2'+d_id).innerHTML=document.getElementById('hp2'+d_id).value*document.getElementById(''+d_id).value;
if (document.getElementById('hp3'+d_id))
document.getElementById('p3'+d_id).innerHTML=document.getElementById('hp3'+d_id).value*document.getElementById(''+d_id).value

  }
 }



function sendform2(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,1)=="-"){

if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("השדות המסומנים באדום הינם שדות חובה, עליך למלא שדות אלו בכדי להמשיך בתהליך")
return false
}
else
return true
}


function timedCount(a,b,c)
{
//document.getElementById('txt').value=c;
var d
d=a
d=d+1;
if (d<c)
{showcampaign(d,b)

setTimeout("timedCount(d,b,c)",5000);
}
}

function checkdelivery()
 {
if (document.getElementById('deliverycoast'))
return true;
else
{
alert('יש לבחור את סוג המשלוח')
return false;
}
  
 }




function right(e) 
{
 
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) 
   return false;
else if (navigator.appName=='Microsoft Internet Explorer' && (event.button==2 || event.button==3)) 
   {  
      alert("השימוש בקליק ימני נוטרל מטעמי אבטחת מידע");
      return false;
   }
return true;
}
 
//document.onmousedown=right


var bookmarkurl="http://www.colors-il.com"
var bookmarktitle="ראשי דיו,טונרים גלילי פקס ומדפסות"
function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}


 function showDivform(d_id)
 {
  d_id.style.display = d_id.style.display == "none" ? "" : "none"

  
 }


/************בדיקת שדות*************/

function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function validate_attach(field,alerttxt)
{
with (field)
{
apos=value.match(".doc");
//dotpos=value.lastIndexOf(".");
if (apos!='.doc') 
  {alert(alerttxt);return false;}
else {return true;}
}



}

function validate_attach2(field,alerttxt)
{
with (field)
{

if (value=='0') 
  {alert(alerttxt);return false;}
else {return true;}
}



}
function validate_form(thisform)
{
with (thisform)
{
//if (validate_required(name,"עליך להזין שם")==false)
  //{name.focus();return false;}
//if (validate_required(phone,"עליך להזין טלפון")==false)
  //{phone.focus();return false;}
//if (validate_email(email,"עליך להזין דואר אלקטרוני נכון")==false)
  //{email.focus();return false;}
if (validate_attach(attach,"עליך לצרף קורות חיים בקובץ WORD בלבד")==false)
  {attach.focus();return false;}
}
}

function validate_form2(thisform)
{
with (thisform)
{
//if (validate_required(name,"עליך להזין שם")==false)
  //{name.focus();return false;}
//if (validate_required(phone,"עליך להזין טלפון")==false)
  //{phone.focus();return false;}
//if (validate_email(email,"עליך להזין דואר אלקטרוני נכון")==false)
  //{email.focus();return false;}
if (validate_attach2(delivery,"לחיפוש משרה עליך לבחור בתחום המשרה")==false)
  {delivery.focus();return false;}
}
}

function checkall(which)
{
  var pass=true
//alert("aaaaaa")
  if (document.MyForm)
  {

   for (i=0;i<document.MyForm.length;i++)
    {
//alert("aaaaaa")
     var tempobj=document.MyForm.elements[i]
     if (tempobj.name.substring(0,7)=="codejob")
     {
if(document.MyForm.checkallc.checked==true)
     tempobj.checked=true
else
tempobj.checked=false
     }
    }
  }
}

