
var i =1;
var ewew= 0;


function writeFlash (flashID, flashMovie, width, height) {

	var t ="";
	t += '<object ';
	t += '	id="' + flashID + '"';
	t += '	classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	t += '	codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ';
	t += '	width="' + width + '" ';
	t += '	height="' + height + '">';
	t += '		<param name="movie" value="' + flashMovie + '">';
	t += '		<param name="wmode" value="transparent">';
	t += '		<embed wmode="transparent" src="' + flashMovie + '" ';
	t += '			name="' + flashID + '"';
	t += '			quality="high" ';
	t += '			pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	t += '			type="application/x-shockwave-flash" ';
	t += '			width="' + width + '" ';
	t += '			height="' + height + '">';
	t += '		</embed>';
	t += '</object>';
	
	document.write (t);
}





function movepic(img_name,img_src) {
document[img_name].src=img_src;
}





//- START ONMOUSE OVER COLOR IN TABLE -->
 

var ns6=document.getElementById&&!document.all
var ie=document.all

function changeto(e,highlightcolor){
source=ie? event.srcElement : e.target
if (source.tagName=="TR"||source.tagName=="TABLE")
return
while(source.tagName!="TD"&&source.tagName!="HTML")
source=ns6? source.parentNode : source.parentElement
if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore")
source.style.backgroundColor=highlightcolor
}

function contains_ns6(master, slave) { //check if slave is contained by master
while (slave.parentNode)
if ((slave = slave.parentNode) == master)
return true;
return false;
}

function changeback(e,originalcolor){
if
(ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TR"||source.tagName=="TABLE")
return
else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore"))
return
if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source)
source.style.backgroundColor=originalcolor
source.style.backgroundColor=originalcolor
}
// END ONMOUSE OVER COLOR IN TABLE -->





var win = null;
function NewWindow(mypage,myname,w,h,scroll){

LeftPosition =  (screen.width/2)-(w/2);
TopPosition =  (screen.height/2)-(h/2);


settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}



//----------------------------------- DHTML email validation script -------------------------->

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}
//-------------------------------- DHTML email validation script end -------------------------->




//---------------------------------- onlyDigits -------------------------->
function onlyDigits(e) {
var _ret = true;
if (window.event.keyCode < 46 || window.event.keyCode > 57) {
window.event.keyCode = 0;
_ret = false;
}
return (_ret); 
}
//------------------------------- onlyDigits  end -------------------------->



function IsNumericCheck(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


   
   
   
   
   


function changestyleOver(current,location,id)
	{
   bgstr= 'url(images/MenuCategory/but0'+location+'_sug_down.png)';
  var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
   itm.className='TitleTatMenuWhite';
   current.style.background=bgstr;

}

function changestyleOut(current,location,id)
	{
        var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
   itm.className='TitleTatMenu';
 current.style.background="url(images/MenuCategory/b_sug_up.png)";
  
}










function OnMouseChangeStyle(current,id,bgstr,className)
	{
    
          var itf = null;
		if (document.getElementById) {
			itf = document.getElementById(current);
		} else if (document.all){
			itf = document.all[current];
		} else if (document.layers){
			itf = document.layers[current];
		}
    
  var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
        
   
        
        
  
   itf.background=bgstr;
    itm.className=className;

    
    
    
}


function OnMouseChangeStyleTat(id,bgstr,className)
	{
    
    
  var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
        
   
        
        
  
   itm.background=bgstr;
    itm.className=className;

    
    
    
}


function OnMouseChangeClassNameOnly(current,ClassName)
	{
//    alert(current.ClassName)
   current.ClassName=ClassName;
//   alert(current.ClassName)
}
function OnMouseChangeFromBorder(current)
	{
 
   current.style.border="0px black solid;";
 }





function OnMouseChangeToBorder(current)
	{

   current.style.border="2px black solid;";

}
function OnMouseChangeFromBorder(current)
	{
 
   current.style.border="0px black solid;";
 }



function OnMouseChange(id,imagesrc){

	var itm = null;
	var itf= null;
	
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
	itm.src=imagesrc
}



function OnMouseTitleCheckOnclick(id, className) {

if(document.form.onclcikid.value==id){
   return false;
  }
  else{
  OnMouseTitle('ProdTD'+id, className);
  }
}

function OnMouseTitle(id, bgimage,color) {
    var itm = null;
    if (document.getElementById) {
        itm = document.getElementById(id);
    } else if (document.all) {
        itm = document.all[id];
    } else if (document.layers) {
        itm = document.layers[id];
    }
    itm.style.backgroundImage = 'url(' + bgimage + ')';
    itm.style.color = color;

}



function ChangeClass(b,className){
	b.className=className;
}

// ------------------------------Login Exist -------------------------------------------------

function ClearUserNameExist(UserNamePar) {

    if (document.form.UserNameExist.value == UserNamePar) {

        document.form.UserNameExist.value = "";
    }


}



function ClearPasswordExist(PasswordPar) {

    if (document.form.PasswordExist.value == PasswordPar) {

        document.form.PasswordExist.value = "";
    }


}

function LoginExist(UserNamePar, PasswordPar, Alert1, Alert2) {

    if (document.form.UserNameExist.value == "" || document.form.UserNameExist.value == UserNamePar) {
        window.alert(Alert1)
        document.form.UserNameExist.focus();
        return false;
    }
    if (document.form.PasswordExist.value == "" || document.form.PasswordExist.value == PasswordPar) {
        window.alert(Alert2)
        document.form.PasswordExist.focus();
        return false;
    }

    var location_str = "OrderForm.asp?UserName=" + document.form.UserNameExist.value + "&Password=" + document.form.PasswordExist.value;
    document.location.href = location_str
    //  alert(location_str)
    // load(location_str, 'dynamic_contest');


}


// ------------------------------Login end- ------------------------------------------------

    
   
    
    
    
    
//------------------- load to div---------------------->

function load2(name, div, name2, div2, metaTitle, metaDescription, metaKeywords) {
  document.getElementById(div).innerHTML = "";
  return ahah2(name, div, name2, div2, metaTitle, metaDescription, metaKeywords);
}


function load(name, div) {

    document.getElementById(div).innerHTML = "";
    return ahah(name, div);
}



function unload(name, div) {
 document.getElementById(div).innerHTML = "";
}

function loadunload(name, div) {
if (document.getElementById(div).innerHTML == "") { 
	ahah(name,div);
    }
else{
    document.getElementById(div).innerHTML = "";
   }
}

function loadunload2(name, div,name2, div2,metaTitle, metaDescription, metaKeywords) {
if (document.getElementById(div).innerHTML == "") { 
	ahah2(name,div,name2, div2,metaTitle, metaDescription, metaKeywords);
    }
else{
    document.getElementById(div).innerHTML = "";
   }
}



function ahah(url, target) {
  document.getElementById(target).innerHTML = '';
  if (window.XMLHttpRequest) {
     req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       req = new ActiveXObject("Msxml2.XMLHTTP");
  }
  

  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-8");
    req.send(null);
  }
}  

function ahah2(url, target,url2, target2,metaTitle, metaDescription, metaKeywords) {
  document.getElementById(target).innerHTML = '';
  if (window.XMLHttpRequest) {
     req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
       req = new ActiveXObject("Msxml2.XMLHTTP");
  }
  

  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone2(url, target,url2, target2,metaTitle, metaDescription, metaKeywords);};
    req.open("GET", url, true);
    req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=iso-8859-8");
    req.send(null);
  }
}

function ahahDone(url, target) {

    if (req.readyState == 4) { // only if req is "loaded"

        if (req.status == 200) { // only if "OK"
            document.getElementById(target).innerHTML = req.responseText;
               } else {
            document.getElementById(target).innerHTML = " AHAH Error:\n" + req.status + "\n" + req.statusText;
        }
    }
}


function ahahDone2(url, target,url2, target2,metaTitle, metaDescription, metaKeywords) {

  if (req.readyState == 4) { // only if req is "loaded"
  
    if (req.status == 200) { // only if "OK"
          document.getElementById(target).innerHTML = req.responseText;
          if(url2!='' && target2!='') {
              load(url2, target2);
             }
          ChangeMetaTags(metaTitle, metaDescription, metaKeywords);
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}


function ChangeMetaTags(metaTitle, metaDescription, metaKeywords) {
    document.title = metaTitle; 
    $('meta[name=Description]').attr('CONTENT', metaDescription);
    $('meta[name=Keywords]').attr('CONTENT', metaKeywords);
    
}


//------------------load to div end ------------------->







function HebDecode(str) { 
   var str2="";
   var ch;
   
  if(str!="")
  {
   for (j=0;j<str.length;j++)
        {
		ch=str.charCodeAt(j);
		if (str2=='')
		{str2=ch}
		else
		{str2=str2+','+ch}
		
		}
   return str2;
   }
 }
 

 

function show(id)
	{
 
		var itm = null;
		if (document.getElementById) {
         
        
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
		if (itm.style) {
        
       
        itm.style.display = ""; 
			
		}
        
       
        
	}

function hide_span(id)
	{
  
		var itm = null;
		if (document.getElementById) {
			itm = document.getElementById(id);
		} else if (document.all){
			itm = document.all[id];
		} else if (document.layers){
			itm = document.layers[id];
		}
		
    
            itm.style.display = "none"; 
	
            
	}
    
function Change(imgName) {


 PicDiv.innerHTML ="";
 t="";

  t +='<img  id="big" name="big" src="'+imgName+'"  border=0 >'
   PicDiv.innerHTML = t;
   
}

  

  

function Search() {
    var Product_Type = document.form.Product_Type.value;
    var Product_SimpleType = document.form.Product_SimpleType.value;
    var Product_SubType = document.form.Product_SubType.value;
    var KeyWords = document.form.KeyWords.value;
    document.location.href = 'ProductLoby.asp?Mode=in&Product_Type=' + Product_Type + '&Product_SimpleType=' + Product_SimpleType + '&Product_SubType=' + Product_SubType + '&KeyWords=' + KeyWords;

}

function SearchHome() {
    var KeyWords = document.form.KeyWords.value;
    document.location.href = 'ProductLoby.asp?Mode=in&KeyWords=' + KeyWords;

}





//----------------------------- send to friends --------------------------------
function CheckSendToFriend() {

    if (document.form.SenderName.value == "") {
        window.alert("! נא להזין שם השולח")
        document.form.SenderName.focus();
        return false;
    }

    if (document.form.SenderEmail.value == "") {
        window.alert("! נא להזין דואר השולח")
        document.form.SenderEmail.focus();
        return false;
    }

    if (document.form.SenderEmail.value != "" && document.form.SenderEmail.value.indexOf('@') == -1) {
        window.alert(".דואר השולח שגויה");
        document.form.SenderEmail.focus();
        return false
    }


    if (document.form.SenderComments.value == "") {
        window.alert("! נא להזין מסך אישי")
        document.form.SenderComments.focus();
        return false;
    }

     if (document.form.ReceiverName.value == "") {
        window.alert("! נא להזין שם המקבל")
        document.form.ReceiverName.focus();
        return false;
    }


    if (document.form.ReceiverEmail.value == "") {
        window.alert("! נא להזין דואר המקבל")
        document.form.ReceiverEmail.focus();
        return false;
    }

    if (document.form.ReceiverEmail.value != "" && document.form.ReceiverEmail.value.indexOf('@') == -1) {
        window.alert(".דואר המקבל שגויה");
        document.form.ReceiverEmail.focus();
        return false
    }


    document.form.action = "MailSend.asp";
    document.form.submit();

}


//----------------------------- send to friends end  --------------------------------


//------------------------------ newsletter --------------------


function SendNewsLetter() {
    
    
    if (document.form.FirstName.value == "") {
        window.alert("! נא להזין שם פרטי ")
        document.form.FirstName.focus();
        return false;
    }

    if (document.form.LastName.value == "") {
        window.alert("! נא להזין שם משפחה ")
        document.form.LastName.focus();
        return false;
    }

    
    if (document.form.Email.value == "") {
        window.alert("! נא להזין דואר ")
        document.form.Email.focus();
        return false;
    }

    if (document.form.Email.value != "" && document.form.Email.value.indexOf('@') == -1) {
        window.alert(".כתובת הדואר האלקטרוני שגויה");
        document.form.Email.focus();
        return false
    }

      if (document.form.Telephone.value == "") {
        window.alert("! נא להזין טלפון ")
        document.form.Telephone.focus();
        return false;
    }

    
    
      if (document.form.City.value == "") {
        window.alert("! נא להזין עיר ")
        document.form.City.focus();
        return false;
    }


   if (document.form.SubjectID.value == "") {
        window.alert("! נא לבחור תחום התערוחות ")
        document.form.SubjectID.focus();
        return false;
    }
    
    document.form.action = "MailSend.asp";
    document.form.submit();
}
//-------------------------------- newsletter---------------------------

// ------------------------------Collectors ------------------------------------------------



function SendCollectors() {


    if (document.form.FirstName.value == "") {
        window.alert("! נא להזין שם פרטי ")
        document.form.FirstName.focus();
        return false;
    }

    if (document.form.LastName.value == "") {
        window.alert("! נא להזין שם משפחה ")
        document.form.LastName.focus();
        return false;
    }


    if (document.form.Email.value == "") {
        window.alert("! נא להזין דואר ")
        document.form.Email.focus();
        return false;
    }

    if (document.form.Email.value != "" && document.form.Email.value.indexOf('@') == -1) {
        window.alert(".כתובת הדואר האלקטרוני שגויה");
        document.form.Email.focus();
        return false
    }

    if (document.form.Telephone.value == "") {
        window.alert("! נא להזין טלפון ")
        document.form.Telephone.focus();
        return false;
    }



    if (document.form.City.value == "") {
        window.alert("! נא להזין עיר ")
        document.form.City.focus();
        return false;
    }


    if (document.form.SubjectID.value == "") {
        window.alert("! נא לבחור תחום התערוחות ")
        document.form.SubjectID.focus();
        return false;
    }
    if (document.form.ApproveAdsMail_checkbox.checked) {
        document.form.ApproveAdsMail.value = "1";
    }
    else {
        document.form.ApproveAdsMail.value = "0";
    }
    if (document.form.ApproveInfoMail_checkbox.checked) {
        document.form.ApproveInfoMail.value = "1";
    }
    else {
        document.form.ApproveInfoMail.value = "0";
    }

    document.form.action = "MailSend.asp";
    document.form.submit();
}

// ------------------------------Collectors end  ------------------------------------------------

// ------------------------------ group  ------------------------------------------------




function Sendgroup() {
    if (document.form.Organization.value == "") {
        window.alert("! נא להזין שם החברה \ אירגון ")
        document.form.Organization.focus();
        return false;
    }

    if (document.form.NumberOfPeople.value == "") {
        window.alert("! נא להזין מספר אנשים משועד בקבוצה ")
        document.form.NumberOfPeople.focus();
        return false;
    }

    if (document.form.VisitDate.value == "") {
        window.alert("! נא להזין תאריך מבוקש ")
        document.form.VisitDate.focus();
        return false;
    }

    if (document.form.VisitHour.value == "") {
        window.alert("! נא להזין שעה מבוקש ")
        document.form.VisitHour.focus();
        return false;
    }



    for (j = 0; j < document.form.languageHadraha_checkbox.length; j++) {
        if (document.form.languageHadraha_checkbox[j].checked) {
            document.form.languageHadraha.value = document.form.languageHadraha_checkbox[j].value;

        }
    }

  
   
    if (document.form.FirstName.value == "") {
        window.alert("! נא להזין איש קשר ")
        document.form.FirstName.focus();
        return false;
    }

  

    if (document.form.Email.value == "") {
        window.alert("! נא להזין דואר ")
        document.form.Email.focus();
        return false;
    }

    if (document.form.Email.value != "" && document.form.Email.value.indexOf('@') == -1) {
        window.alert(".כתובת הדואר האלקטרוני שגויה");
        document.form.Email.focus();
        return false
    }

    if (document.form.Telephone.value == "") {
        window.alert("! נא להזין טלפון ")
        document.form.Telephone.focus();
        return false;
    }



    if (document.form.Comments.value == "") {
        window.alert("! נא להזין הערות ושאלות ")
        document.form.Comments.focus();
        return false;
    }

 
    document.form.action = "MailSend.asp";
    document.form.submit();
}
// ------------------------------ group end  ------------------------------------------------


// ------------------------------Contact ------------------------------------------------



function CheckContact(){

    if (document.form.fullname.value == "") {
		window.alert("! נא להזין שם")
		document.form.fullname.focus();
		return false;
	}



if (document.form.phone.value == "") {
    if (document.form.phone.value.length < 7) {
		window.alert("מספר הטלפון אינו תקין");
		document.form.phone.focus();
		return false;
	}


for (j = 0; j < document.form.phone.value.length; j++)
	  {
	   checkNum=true
	   strChar = document.form.phone.value.charAt(j);
      
	  checkQ=parseInt(strChar) 
	
      if (isNaN(checkQ))
	  {
	  checkNum=false
	  }
	  }
	
	if (checkNum==false) {
   alert("! נא להזין מספר טלפון בספרות בלבד")
   document.form.phone.focus();
   return false
   }

}

	

 if (document.form.email.value==""){
		window.alert("! נא להזין דואר אלקטרוני")
		document.form.email.focus();
		return false;
	}
	
if ( document.form.email.value!="" && document.form.email.value.indexOf('@')==-1){
		window.alert(".כתובת הדואר האלקטרוני שגויה");
		document.form.email.focus();
		return false
		}
	document.form.action="DoSendContact.asp";
document.form.submit();

}


function CleanContact(){
document.form.reset();
}






 // ------------------------------Contact ------------------------------------------------





function IsNumericCheck(sText) {
    var ValidChars = "0123456789.";
    var IsNumber = true;
    var Char;


    for (i = 0; i < sText.length && IsNumber == true; i++) {
        Char = sText.charAt(i);
        if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
        }
    }
    return IsNumber;

}





//////////////////////////////////////////------------------------------- basket ----------------------//////////////////////////////////////
function MinusQuan(productId,price,points,weight)
{

minquan=0
var prefixProductQuantity="ProductQuantity"+productId
var prefixTotalProductprice="TotalProductprice"+productId

var prefixTotalProductPointsNo="TotalProductPointsNo"+productId
var prefixTotalProductWeight="TotalProductWeight"+productId
var currentQuan=0

for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixProductQuantity)
	    {
      	currentQuan=element.value-1
		if (currentQuan<minquan){
		
		window.alert("Please, insert value>="+minquan)
		return false;
		  }
		  else
		element.value=currentQuan
	     }
  	}

	
	for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixTotalProductprice) {
      
		TotalProductprice=parseFloat(currentQuan*price)
          element.value = (FormatNumber(TotalProductprice,0,false,false,true)); //Math.round(TotalProductprice*100)/100;
		element.style.width=parseFloat(element.value.length*7)
		
		totalOrderPrice=parseFloat(document.form.totalOrderPrice_hidden.value)-parseFloat(price)
		document.form.totalOrderPrice_hidden.value=Math.round(totalOrderPrice*100)/100;
		totalOrderPrice = (FormatNumber(totalOrderPrice,0,false,false,true));
		 document.form.totalOrderPrice.value=totalOrderPrice; //Math.round(totalOrderPrice*100)/100;
         document.form.totalOrderPrice.style.width=parseFloat( document.form.totalOrderPrice.value.length*8)
		
      /*totalOrderPrice = parseFloat(document.form.totalOrderPrice.value-price)
        document.form.totalOrderPrice.value=Math.round(totalOrderPrice*100)/100;
		 document.form.totalOrderPrice.style.width=parseFloat( document.form.totalOrderPrice.value.length*8)*/
			}
      if (element.name == prefixTotalProductPointsNo) {        
            element.value=parseFloat(currentQuan*points)
            element.style.width=parseFloat(element.value.length*7)
		         document.form.totalOrderPointsNo.value=parseFloat(document.form.totalOrderPointsNo.value-points)
              document.form.totalOrderPointsNo.style.width=parseFloat( document.form.totalOrderPointsNo.value.length*8)
		    }
            
          
            
             if (element.name == prefixTotalProductWeight) { 
               OrderWeight=parseFloat(currentQuan*weight)
                 element.value=Math.round(OrderWeight*100)/100;
                element.style.width=parseFloat(element.value.length*7)
                 totalOrderWeight=  parseFloat(document.form.totalOrderWeight.value-weight)
		         document.form.totalOrderWeight.value=Math.round(totalOrderWeight*100)/100;
                document.form.totalOrderWeight.style.width=parseFloat( document.form.totalOrderWeight.value.length*8)
		 
            }   
  	}

   
	
	

	}

function PlusQuan(productId,price,points,weight)
{

var prefixProductQuantity="ProductQuantity"+productId
var prefixTotalProductprice="TotalProductprice"+productId
var prefixTotalProductPointsNo="TotalProductPointsNo"+productId
var prefixTotalProductWeight="TotalProductWeight"+productId
var currentQuan=0

for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixProductQuantity)
	    {
        currentQuan= element.value
		currentQuan++
		element.value=currentQuan
	     }
  	}

	
	for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixTotalProductprice) {
      
		TotalProductprice=parseFloat(currentQuan*price)
		element.value= (FormatNumber(TotalProductprice,0,false,false,true)); //Math.round(TotalProductprice*100)/100;
        element.style.width=parseFloat(element.value.length*7)
        
        totalOrderPrice=parseFloat(document.form.totalOrderPrice_hidden.value)+parseFloat(price)
		document.form.totalOrderPrice_hidden.value=Math.round(totalOrderPrice*100)/100;
		totalOrderPrice = (FormatNumber(totalOrderPrice,0,false,false,true));
		 document.form.totalOrderPrice.value=totalOrderPrice; //Math.round(totalOrderPrice*100)/100;
         document.form.totalOrderPrice.style.width=parseFloat( document.form.totalOrderPrice.value.length*8)
		
		}
         if (element.name == prefixTotalProductPointsNo) {        
            element.value=parseFloat(currentQuan*points)
            element.style.width=parseFloat(element.value.length*7)
		   document.form.totalOrderPointsNo.value=parseFloat(document.form.totalOrderPointsNo.value)+parseFloat(points)
            document.form.totalOrderPointsNo.style.width=parseFloat( document.form.totalOrderPointsNo.value.length*8)
		 
            }
            
           if (element.name == prefixTotalProductWeight) { 
           OrderWeight=parseFloat(currentQuan*weight)
            element.value=Math.round(OrderWeight*100)/100;
            element.style.width=parseFloat(element.value.length*7)
            
             totalOrderWeight=parseFloat(document.form.totalOrderWeight.value)+parseFloat(weight)
		     document.form.totalOrderWeight.value=Math.round(totalOrderWeight*100)/100;
              document.form.totalOrderWeight.style.width=parseFloat( document.form.totalOrderWeight.value.length*8)
		 
            }   
  	}


	   
}	


function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas)
{ 
        if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}

/** added by kfir - formatNumber Function **/


function ChangeQuan(productId,price,points,weight)
{

minquan=0
var prefixProductQuantity="ProductQuantity"+productId

var prefixTotalProductpriceAll="TotalProductprice"
var prefixTotalProductprice="TotalProductprice"+productId

var prefixtotalProductPointsNoAll="TotalProductPointsNo"
var prefixTotalProductPointsNo="TotalProductPointsNo"+productId

var  prefixTotalProductWeightAll="TotalProductWeight"
var prefixTotalProductWeight="TotalProductWeight"+productId



var currentQuan=0
var totalOrderPrice=0
var totalOrderPointsNo=0
var totalOrderWeight=0
for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixProductQuantity)
	    {
      	currentQuan=element.value
		}
  	}
for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name == prefixTotalProductprice) {
      
		TotalProductprice=parseFloat(currentQuan*price)
         element.value=Math.round(TotalProductprice*100)/100;
		element.style.width=parseFloat(element.value.length*7)
    	}
        
         if (element.name == prefixTotalProductPointsNo) {
      
		element.value=parseFloat(currentQuan*points)
		element.style.width=parseFloat(element.value.length*7)
    	}
        if (element.name == prefixTotalProductWeight) {
        OrderWeight=parseFloat(currentQuan*weight)
        element.value=Math.round(OrderWeight*100)/100;
		
		element.style.width=parseFloat(element.value.length*7)
    	}
        
  	}


for (i=0; i<document.form.elements.length; i++) {
    element = document.form.elements[i];
    if (element.name.substring(0,17) == prefixTotalProductpriceAll) {
	
     	  totalOrderPrice =parseFloat(totalOrderPrice)+parseFloat(element.value) 
          totalOrderPrice=Math.round(totalOrderPrice*100)/100;
        
	 	}
     if (element.name.substring(0,20) == prefixtotalProductPointsNoAll) {
	 	  totalOrderPointsNo =parseFloat(totalOrderPointsNo)+parseFloat(element.value) 
        
	 	}
         
        if (element.name.substring(0,18) == prefixTotalProductWeightAll) {
        
       
        
	 	  totalOrderWeight =parseFloat(totalOrderWeight)+parseFloat(element.value) 
          totalOrderWeight=Math.round(totalOrderWeight*100)/100;
        
	 	}
           
  	}

   
 
 	        document.form.totalOrderPrice.value=totalOrderPrice
            document.form.totalOrderPrice.style.width=parseFloat( document.form.totalOrderPrice.value.length*8)
		 
            
      
		   
}

function SelectedPoints()
{


prefix_Master_totalOrderPrice_shipping= "Master_totalOrderPrice_shipping"
prefixtotalOrderMainPrice_shipping="totalOrderMainPrice_shipping"
 client_points_count= document.submitorder.client_points_count.value
 totalOrderPriceMaster= document.submitorder.totalOrderPriceMaster.value
 OrderPriceTottallyMaster= document.submitorder.OrderPriceTottallyMaster.value
 totalOrderPrice=parseFloat(totalOrderPriceMaster-client_points_count)

 
  document.submitorder.totalOrderPrice.value=Math.round(totalOrderPrice*100)/100;
 OrderPriceTottally=parseFloat(OrderPriceTottallyMaster-client_points_count)
    document.submitorder.OrderPriceTottally.value=Math.round(OrderPriceTottally*100)/100;
   
 
    DiffOrderPriceTottallyMaster= document.submitorder.DiffOrderPriceTottallyMaster.value
    DiffOrderTottally=parseFloat(DiffOrderPriceTottallyMaster)+parseFloat(client_points_count)
    document.submitorder.DiffOrderPriceTottally.value=Math.round(DiffOrderTottally*100)/100;
   document.submitorder.DiffOrderPriceTottally.style.width=parseFloat( document.submitorder.DiffOrderPriceTottally.value.length*10)
   
  
   for (i=0; i<document.submitorder.elements.length; i++) {
    element = document.submitorder.elements[i];
     
   
     if (element.name.substring(0,31) == prefix_Master_totalOrderPrice_shipping) {
	   
         points_value =element.value
     	  points_count =eval(points_value-client_points_count)
         
     	}
  
    
        
   if (element.name.substring(0,28) == prefixtotalOrderMainPrice_shipping) {
	
     	  element.value =points_count
      }
      }
  
  
}



function SelectedPointsMinPrice()
{



 client_points_count= document.submitorder.client_points_count.value
 totalOrderPriceMaster= document.submitorder.totalOrderPriceMaster.value
 
 totalOrderPrice=parseFloat(totalOrderPriceMaster-client_points_count)

  document.submitorder.totalOrderPrice.value=Math.round(totalOrderPrice*100)/100;
  OrderPriceTottally=parseFloat(totalOrderPriceMaster-client_points_count)
   document.submitorder.OrderPriceTottally.value=Math.round(OrderPriceTottally*100)/100;
   
  DiffOrderPriceTottallyMaster= document.submitorder.DiffOrderPriceTottallyMaster.value
    DiffOrderTottally=parseFloat(DiffOrderPriceTottallyMaster)+parseFloat(client_points_count)
    document.submitorder.DiffOrderPriceTottally.value=Math.round(DiffOrderTottally*100)/100;
     document.submitorder.DiffOrderPriceTottally.style.width=parseFloat( document.submitorder.DiffOrderPriceTottally.value.length*10)
   
  
}


function SetShipping(objform){
  
  var GetMethodID=document.form.GetMethodID.value;

  var   shippingname="shipping_span";
  var    totalOrderPrice="totalOrderPrice";
	 var totalOrderPrice2="totalOrderPrice2";
   
        if (document.getElementById) {
			shippingnameObj = document.getElementById(shippingname);
		} else if (document.all){
			shippingnameObj = document.all[shippingname];
		} else if (document.layers){
			shippingnameObj = document.layers[shippingname];
		}
       
         if (document.getElementByName) {
			totalOrderPriceObj = document.getElementByName(totalOrderPrice);
		} else if (document.all){
			totalOrderPriceObj = document.all[totalOrderPrice];
		} else if (document.layers){
			totalOrderPriceObj = document.layers[totalOrderPrice];
		}
         	 totalOrderPrice=totalOrderPriceObj.value;
         

         if (document.getElementByName) {
			totalOrderPrice2Obj = document.getElementById(totalOrderPrice2);
		} else if (document.all){
			totalOrderPrice2Obj = document.all[totalOrderPrice2];
		} else if (document.layers){
			totalOrderPrice2Obj = document.layers[totalOrderPrice2];
		}
         	
         
          // alert("totalOrderPrice="+totalOrderPrice);
          // alert("GetMethodID="+GetMethodID);
          totalOrderPrice2=parseFloat(totalOrderPrice)+parseFloat(GetMethodID)
         //alert("totalOrderPrice2="+totalOrderPrice2);
shippingnameObj.innerHTML=Math.round(GetMethodID*100)/100;
totalOrderPrice2Obj.innerHTML=(FormatNumber(totalOrderPrice2,0,false,false,true))//Math.round(totalOrderPrice2*100)/100;



}


function DeleteItem(num, id) {
    var location_str = "XMLToBasket_inc.asp?LocationFrom=yes&number=" + num + "&delupdate=delete";
    load(location_str,'dynamic_contest');
}

function DeleteAll(){
    var location_str = "XMLToBasket_inc.asp?delupdate=delal";
    load(location_str,'dynamic_contest');
}


function SendBasket()
{
//document.form.action="https://www.laserprint.co.il/checkout.asp";	
document.form.action="OrderForm.asp";
document.form.submit();

}



function KeepBasket(down) {
    ProductQuantity_Str = "";
    Product_Id_Str = document.form.Product_Id_Str.value;


    Product_Id_arr = Product_Id_Str.split(',');
    for (i = 0; i < Product_Id_arr.length; i++) {
        if (Product_Id_arr[i] != '') {
            quantityname = "ProductQuantity" + Product_Id_arr[i]
            if (document.getElementByName) {
                quantitynameObj = document.getElementByName(quantityname);
            } else if (document.all) {
                quantitynameObj = document.all[quantityname];
            } else if (document.layers) {
                quantitynameObj = document.layers[quantityname];
            }
            quantity = quantitynameObj.value;
        }
        else {
            quantity = '';
        }
        if (ProductQuantity_Str == "") {
            ProductQuantity_Str = quantity
        }
        else {
            ProductQuantity_Str = ProductQuantity_Str + "," + quantity
        }

       

    }
  
    if (down == 'yes')
{
    var location_str = "XMLToBasket_inc.asp?keep=yes&LocationFrom=yes&Product_Id_Str=" + Product_Id_Str + "&ProductQuantity_Str=" + ProductQuantity_Str;
 load(location_str,'dynamic_contest');
}
}


//   -------------------------- basket end  ---------------//////////////////////////////////////////////////////////////////

function SelectTypeProduct(b, from) {
    var xmlDoc
    var xslDoc
    var Product_Type = b.form.Product_Type.value;
    load('XMLSelectProductSubType.asp?Product_Type=' + Product_Type, from);
}


function OpenCloseCV(divbase, maxno) {
    var i = 0;
    for (i = 0; i <= maxno; i++) {
        div = divbase +''+ maxno;
        if (document.getElementById(div).style.display=='none') {
            document.getElementById(div).style.display = '';
            document.getElementById("selectcv").innerHTML = "סגור מידע";
              }
         else {
               document.getElementById(div).style.display = 'none';
               document.getElementById("selectcv").innerHTML = "לחץ להמשך מידע";
          
           }
       }



 }

