﻿function MM_swapImgRestore() { //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 MM_preloadImages() { //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=MM_preloadImages.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 MM_findObj(n, d) { //v3.0
  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=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ChangeImageSource( liIndex )
 {
 document.getElementById('bigpicture').src = 'images/' + liIndex;
 }

 // This is the implementation of SimpleSwap
 // by Jehiah Czebotar
 // Version 1.1 - June 10, 2005
 // Distributed under Creative Commons
 //
 // Include this script on your page
 // then make image rollovers simple like:
 // <img src="/images/ss_img.gif" oversrc="/images/ss_img_over.gif">
 //
 // http://jehiah.com/archive/simple-swap
 //


 function SimpleSwap(el,which){
   el.src=el.getAttribute(which || "origsrc");
 }

 function SimpleSwapSetup(){
   var x = document.getElementsByTagName("img");
   for (var i=0;i<x.length;i++){
     var oversrc = x[i].getAttribute("oversrc");
     if (!oversrc) continue;

     // preload image
     // comment the next two lines to disable image pre-loading
     x[i].oversrc_img = new Image();
     x[i].oversrc_img.src=oversrc;
     // set event handlers
     x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
     x[i].onmouseout = new Function("SimpleSwap(this);");
     // save original src
     x[i].setAttribute("origsrc",x[i].src);
   }
 }

 var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
 window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}


  function show(object) {
     if (document.getElementById && document.getElementById(object) != null)
          node = document.getElementById(object).style.display='block';
     else if (document.layers && document.layers[object] != null)
         document.layers[object].display = 'block';
     else if (document.all)
         document.all[object].style.display = 'block';

 if (document.getElementById && document.getElementById(object) != null)
 node = document.getElementById(object).style.display='block';
 else if (document.layers && document.layers[object] != null)
 document.layers[object].display = 'block';
 else if (document.all)
 document.all[object].style.display = 'block';

 }

 function hide(object) {
     if (document.getElementById && document.getElementById(object) != null)
          node = document.getElementById(object).style.display='none';
     else if (document.layers && document.layers[object] != null)
         document.layers[object].display = 'none';
     else if (document.all)
          document.all[object].style.display = 'none';
 }

function enableCreditCard(what){
if (!what.phoneorder[0].checked) {
document.getElementById('creditcard_panel').style.display="none"
} else {
document.getElementById('creditcard_panel').style.display="block"
}
}

var fadebgcolor="white"

////NO need to edit beyond here/////////////

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers

var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all

function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}

var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2

if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')

if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}

fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}


fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}

fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}


fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

function data_copy()
{



if(document.procform.othership.checked== true){
document.procform.fname2.value=document.procform.f_name.value;
document.procform.lname2.value=document.procform.l_name.value;
document.procform.street2.value=document.procform.street.value;
document.procform.house_num2.value=document.procform.house_num.value;
document.procform.apprt_num2.value=document.procform.apprt_num.value;
document.procform.city2.value=document.procform.city.value;
document.procform.level2.value=document.procform.level.value;
document.procform.zip2.value=document.procform.zip.value;

}else{

document.procform.fname2.value="";
document.procform.lname2.value="";
document.procform.street2.value="";
document.procform.house_num2.value="";
document.procform.apprt_num2.value="";
document.procform.city2.value="";
document.procform.level2.value="";
document.procform.zip2.value="";

}

}


function FormCheck (form,shipopt) {



if (form.f_name.value == "") {
alert( "נא להזין שם פרטי" );
form.f_name.focus();
return false ;
}

if (form.l_name.value == "") {
alert( "נא להזין שם משפחה" );
form.l_name.focus();
return false ;
}



/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address.
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var emailStr=form.email.value

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("כתובת הדואר האלקטרוני אינה תקינה")
	form.email.focus()
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid
if (user.match(userPat)==null) {
    // user is not valid
    alert("כתובת הדואר האלקטרוני אינה תקינה")
    form.email.focus()
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("כתובת הדואר האלקטרוני אינה תקינה")
		form.email.focus()
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("כתובת הדואר האלקטרוני אינה תקינה")
    form.email.focus()
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 ||
    domArr[domArr.length-1].length>4) {
   // the address must end in a two letter or three letter word.
   alert("כתובת הדואר האלקטרוני אינה תקינה")
   form.email.focus()
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
  alert(errStr)
  form.email.focus()
  return false

}

// If we've gotten this far, everything's valid!


if (form.home_phone.value == "") {
alert( "נא להזין מספר טלפון" );
form.home_phone.focus();
return false ;
}




if (shipopt != 3) {

	if (form.street.value == "") {
	alert( "נא להזין את שם הרחוב" );
	form.street.focus();
	return false ;
	}

	if (form.house_num.value == "") {
	alert( "נא להזין את מספר הבית" );
	form.house_num.focus();
	return false ;
	}

	if (form.city.value == "") {
	alert( "נא להזין את שם העיר או היישוב" );
	form.city.focus();
	return false ;
	}


	if (form.othership.checked== false) {


		if (form.fname2.value == "") {
		alert( "נא להזין את השם הפרטי של מקבל המשלוח" );
		form.fname2.focus();
		return false ;
		}

		if (form.lname2.value == "") {
		alert( "נא להזין את שם המשפחה של מקבל המשלוח" );
		form.lname2.focus();
		return false ;
		}


		if (form.street2.value == "") {
		alert( "נא להזין את שם הרחוב של מקבל המשלוח" );
		form.street2.focus();
		return false ;
		}

		if (form.house_num2.value == "") {
		alert( "נא להזין את מספר הבית של מקבל המשלוח" );
		form.house_num2.focus();
		return false ;
		}

		if (form.city2.value == "") {
		alert( "נא להזין את שם העיר של מקבל המשלוח" );
		form.city2.focus();
		return false ;
		}

	}

}




phoneor = -1;
 for (i=form.phoneorder.length-1; i > -1; i--) {
 if (form.phoneorder[i].checked) {
 phoneor = form.phoneorder[i].value;
  }
 }
 if (phoneor == "off") {

		 var listCheck = form.card_type.selectedIndex;
		 if (form.card_type.options[listCheck].value=="") {
		 alert( "נא לבחור את סוג כרטיס האשראי" );
		 form.card_type.focus();
  		 return false ;
		  }



		if (form.cnum.value == "") {
  		alert( "נא להזין את מספר כרטיס האשראי" );
  		form.cnum.focus();
  		return false ;
		}

		var listCheck2 = form.month.selectedIndex;
		if (form.month.options[listCheck2].value=="") {
		alert( "נא לבחור את חודש התוקף של הכרטיס" );
		form.month.focus();
		return false ;
		}

		var listCheck3 = form.year.selectedIndex;
				if (form.year.options[listCheck3].value=="") {
				alert( "נא לבחור את השנה של תוקף הכרטיס" );
				form.year.focus();
				return false ;
		}


		if (form.p_id.value == "") {
		alert( "נא להזין את תעודת הזהות של בעל הכרטיס" );
		form.p_id.focus();
		return false ;
		}
		if (form.fname.value == "") {
		alert( "נא להזין את שם בעל הכרטיס" );
		form.fname.focus();
		return false ;
		}




	}


return true;
}




function FormCheckb2b (form) {



if (form.fname.value == "") {
alert( "נא להזין שם פרטי" );
form.fname.focus();
return false ;
}


if (form.bus.value == "") {
alert( "נא להזין את שם העסק" );
form.bus.focus();
return false ;
}

if (form.phone.value == "") {
alert( "נא להזין טלפון" );
form.phone.focus();
return false ;
}

if (form.email.value == "") {
alert( "נא להזין כתובת דואר אלקטרוני" );
form.email.focus();
return false ;
}


return true;
}


function FormCheckContact (form) {



if (form.fname.value == "") {
alert( "נא להזין שם פרטי" );
form.fname.focus();
return false ;
}


if (form.city.value == "") {
alert( "נא להזין את שם העיר" );
form.city.focus();
return false ;
}

if (form.phone.value == "") {
alert( "נא להזין טלפון" );
form.phone.focus();
return false ;
}

if (form.email.value == "") {
alert( "נא להזין כתובת דואר אלקטרוני" );
form.email.focus();
return false ;
}


return true;
}
