

/* --- BoxOver ---
/* --- v 2.1 17th June 2006
By Oliver Bryant with help of Matthew Tagg
http://boxover.swazz.org */

if (typeof document.attachEvent!='undefined') {
   window.attachEvent('onload',init);
   document.attachEvent('onmousemove',moveMouse);
   document.attachEvent('onclick',checkMove); }
else {
   window.addEventListener('load',init,false);
   document.addEventListener('mousemove',moveMouse,false);
   document.addEventListener('click',checkMove,false);
}

var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;

function init() {
	oDv.appendChild(dvHdr);
	oDv.appendChild(dvBdy);
	oDv.style.position="absolute";
	oDv.style.visibility='hidden';
	document.body.appendChild(oDv);	
}

function defHdrStyle() {
//	dvHdr.innerHTML='<img  style="vertical-align:middle"  src="info.gif">&nbsp;&nbsp;'+dvHdr.innerHTML;
	dvHdr.style.fontWeight='bold';
	dvHdr.style.width='320px';
	dvHdr.style.direction='rtl';
	dvHdr.style.fontFamily='arial';
	dvHdr.style.border='1px solid #A5CFE9';
	dvHdr.style.padding='3';
	dvHdr.style.fontSize='15';
	dvHdr.style.color='black';	
	
	//dvHdr.style.background='#D5EBF9'; 
	dvHdr.style.background='#FFE817';
	//dvHdr.style.filter='alpha(opacity=85)'; // IE
	//dvHdr.style.opacity='0.85'; // FF
	
	
}

function defBdyStyle() {
	dvBdy.style.borderBottom='1px solid #A5CFE9';
	dvBdy.style.borderLeft='1px solid #A5CFE9';
	dvBdy.style.borderRight='1px solid #A5CFE9';
	dvBdy.style.width='320px';
	dvBdy.style.direction='rtl';
	dvBdy.style.fontFamily='arial';
	dvBdy.style.fontSize='15';
	dvBdy.style.padding='3';
	dvBdy.style.color='black';
	
	dvBdy.style.background='#FAFF89';
	
	//dvBdy.style.filter='alpha(opacity=85)'; // IE
	//dvBdy.style.opacity='0.85'; // FF
	
}

function checkElemBO(txt) {
if (!txt || typeof(txt) != 'string') return false;
if ((txt.indexOf('header')>-1)&&(txt.indexOf('body')>-1)&&(txt.indexOf('[')>-1)&&(txt.indexOf('[')>-1)) 
   return true;
else
   return false;
}

function scanBO(curNode) {
	  if (checkElemBO(curNode.title)) {
         curNode.boHDR=getParam('header',curNode.title);
         curNode.boBDY=getParam('body',curNode.title);
			curNode.boCSSBDY=getParam('cssbody',curNode.title);			
			curNode.boCSSHDR=getParam('cssheader',curNode.title);
			curNode.IEbugfix=(getParam('hideselects',curNode.title)=='on')?true:false;
			curNode.fixX=parseInt(getParam('fixedrelx',curNode.title));
			curNode.fixY=parseInt(getParam('fixedrely',curNode.title));
			curNode.absX=parseInt(getParam('fixedabsx',curNode.title));
			curNode.absY=parseInt(getParam('fixedabsy',curNode.title));
			curNode.offY=(getParam('offsety',curNode.title)!='')?parseInt(getParam('offsety',curNode.title)):10;
			curNode.offX=(getParam('offsetx',curNode.title)!='')?parseInt(getParam('offsetx',curNode.title)):10;
			curNode.fade=(getParam('fade',curNode.title)=='on')?true:false;
			curNode.fadespeed=(getParam('fadespeed',curNode.title)!='')?getParam('fadespeed',curNode.title):0.04;
			curNode.delay=(getParam('delay',curNode.title)!='')?parseInt(getParam('delay',curNode.title)):0;
			if (getParam('requireclick',curNode.title)=='on') {
				curNode.requireclick=true;
				document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
				document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
			}
			else {// Note : if requireclick is on the stop clicks are ignored   			
   			if (getParam('doubleclickstop',curNode.title)!='off') {
   				document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
   			}	
   			if (getParam('singleclickstop',curNode.title)=='on') {
   				document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
   			}
   		}
			curNode.windowLock=getParam('windowlock',curNode.title).toLowerCase()=='off'?false:true;
			curNode.title='';
			curNode.hasbox=1;
	   }
	   else
	      curNode.hasbox=2;   
}


function getParam(param,list) {
	var reg = new RegExp('([^a-zA-Z]' + param + '|^' + param + ')\\s*=\\s*\\[\\s*(((\\[\\[)|(\\]\\])|([^\\]\\[]))*)\\s*\\]');
	var res = reg.exec(list);
	var returnvar;
	if(res)
		return res[2].replace('[[','[').replace(']]',']');
	else
		return '';
}

function Left(elem){	
	var x=0;
	if (elem.calcLeft)
		return elem.calcLeft;
	var oElem=elem;
	while(elem){
		 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderLeftWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderLeftWidth);
		 x+=elem.offsetLeft;
		 elem=elem.offsetParent;
	  } 
	oElem.calcLeft=x;
	return x;
	}

function Top(elem){
	 var x=0;
	 if (elem.calcTop)
	 	return elem.calcTop;
	 var oElem=elem;
	 while(elem){		
	 	 if ((elem.currentStyle)&& (!isNaN(parseInt(elem.currentStyle.borderTopWidth)))&&(x!=0))
		 	x+=parseInt(elem.currentStyle.borderTopWidth); 
		 x+=elem.offsetTop;
	         elem=elem.offsetParent;
 	 } 
 	 oElem.calcTop=x;
 	 return x;
 	 
}

var ah,ab;
function applyStyles() {
	if(ab)
		oDv.removeChild(dvBdy);
	if (ah)
		oDv.removeChild(dvHdr);
	dvHdr=document.createElement("div");
	dvBdy=document.createElement("div");
	CBE.boCSSBDY?dvBdy.className=CBE.boCSSBDY:defBdyStyle();
	CBE.boCSSHDR?dvHdr.className=CBE.boCSSHDR:defHdrStyle();
	dvHdr.innerHTML=CBE.boHDR;
	dvBdy.innerHTML=CBE.boBDY;
	ah=false;
	ab=false;
	if (CBE.boHDR!='') {		
		oDv.appendChild(dvHdr);
		ah=true;
	}	
	if (CBE.boBDY!=''){
		oDv.appendChild(dvBdy);
		ab=true;
	}	
}

var CSE,iterElem,LSE,CBE,LBE, totalScrollLeft, totalScrollTop, width, height ;
var ini=false;

// Customised function for inner window dimension
function SHW() {
   if (document.body && (document.body.clientWidth !=0)) {
      width=document.body.clientWidth;
      height=document.body.clientHeight;
   }
   if (document.documentElement && (document.documentElement.clientWidth!=0) && (document.body.clientWidth + 20 >= document.documentElement.clientWidth)) {
      width=document.documentElement.clientWidth;   
      height=document.documentElement.clientHeight;   
   }   
   return [width,height];
}


var ID=null;
function moveMouse(e) {
   //boxMove=true;
	e?evt=e:evt=event;
	
	CSE=evt.target?evt.target:evt.srcElement;
	
	if (!CSE.hasbox) {
	   // Note we need to scan up DOM here, some elements like TR don't get triggered as srcElement
	   iElem=CSE;
	   while ((iElem.parentNode) && (!iElem.hasbox)) {
	      scanBO(iElem);
	      iElem=iElem.parentNode;
	   }	   
	}
	
	if ((CSE!=LSE)&&(!isChild(CSE,dvHdr))&&(!isChild(CSE,dvBdy))){		
	   if (!CSE.boxItem) {
			iterElem=CSE;
			while ((iterElem.hasbox==2)&&(iterElem.parentNode))
					iterElem=iterElem.parentNode; 
			CSE.boxItem=iterElem;
			}
		iterElem=CSE.boxItem;
		if (CSE.boxItem&&(CSE.boxItem.hasbox==1))  {
			LBE=CBE;
			CBE=iterElem;
			if (CBE!=LBE) {
				applyStyles();
				if (!CBE.requireclick)
					if (CBE.fade) {
						if (ID!=null)
							clearTimeout(ID);
						ID=setTimeout("fadeIn("+CBE.fadespeed+")",CBE.delay);
					}
					else {
						if (ID!=null)
							clearTimeout(ID);
						COL=1;
						ID=setTimeout("oDv.style.visibility='visible';ID=null;",CBE.delay);						
					}
				if (CBE.IEbugfix) {hideSelects();} 
				fixposx=!isNaN(CBE.fixX)?Left(CBE)+CBE.fixX:CBE.absX;
				fixposy=!isNaN(CBE.fixY)?Top(CBE)+CBE.fixY:CBE.absY;			
				lockX=0;
				lockY=0;
				boxMove=true;
				ox=CBE.offX?CBE.offX:10;
				oy=CBE.offY?CBE.offY:10;
			}
		}
		else if (!isChild(CSE,dvHdr) && !isChild(CSE,dvBdy) && (boxMove))	{
			// The conditional here fixes flickering between tables cells.
			if ((!isChild(CBE,CSE)) || (CSE.tagName!='TABLE')) {   			
   			CBE=null;
   			if (ID!=null)
  					clearTimeout(ID);
   			fadeOut();
   			showSelects();
			}
		}
		LSE=CSE;
	}
	else if (((isChild(CSE,dvHdr) || isChild(CSE,dvBdy))&&(boxMove))) {
		totalScrollLeft=0;
		totalScrollTop=0;
		
		iterElem=CSE;
		while(iterElem) {
			if(!isNaN(parseInt(iterElem.scrollTop)))
				totalScrollTop+=parseInt(iterElem.scrollTop);
			if(!isNaN(parseInt(iterElem.scrollLeft)))
				totalScrollLeft+=parseInt(iterElem.scrollLeft);
			iterElem=iterElem.parentNode;			
		}
		if (CBE!=null) {
			boxLeft=Left(CBE)-totalScrollLeft;
			boxRight=parseInt(Left(CBE)+CBE.offsetWidth)-totalScrollLeft;
			boxTop=Top(CBE)-totalScrollTop;
			boxBottom=parseInt(Top(CBE)+CBE.offsetHeight)-totalScrollTop;
			doCheck();
		}
	}
	
	if (boxMove&&CBE) {
		// This added to alleviate bug in IE6 w.r.t DOCTYPE
		bodyScrollTop=document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop;
		bodyScrollLet=document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft;
		mouseX=evt.pageX?evt.pageX-bodyScrollLet:evt.clientX-document.body.clientLeft;
		mouseY=evt.pageY?evt.pageY-bodyScrollTop:evt.clientY-document.body.clientTop;
		if ((CBE)&&(CBE.windowLock)) {
			mouseY < -oy?lockY=-mouseY-oy:lockY=0;
			mouseX < -ox?lockX=-mouseX-ox:lockX=0;
			mouseY > (SHW()[1]-oDv.offsetHeight-oy)?lockY=-mouseY+SHW()[1]-oDv.offsetHeight-oy:lockY=lockY;
			mouseX > (SHW()[0]-dvBdy.offsetWidth-ox)?lockX=-mouseX-ox+SHW()[0]-dvBdy.offsetWidth:lockX=lockX;			
		}
		oDv.style.left=((fixposx)||(fixposx==0))?fixposx:bodyScrollLet+mouseX+ox+lockX+"px";
		oDv.style.top=((fixposy)||(fixposy==0))?fixposy:bodyScrollTop+mouseY+oy+lockY+"px";		
		
	}
}

function doCheck() {	
	if (   (mouseX < boxLeft)    ||     (mouseX >boxRight)     || (mouseY < boxTop) || (mouseY > boxBottom)) {
		if (!CBE.requireclick)
			fadeOut();
		if (CBE.IEbugfix) {showSelects();}
		CBE=null;
	}
}

function pauseBox(e) {
   e?evt=e:evt=event;
	boxMove=false;
	evt.cancelBubble=true;
}

function showHideBox(e) {
	oDv.style.visibility=(oDv.style.visibility!='visible')?'visible':'hidden';
}

function hideBox(e) {
	oDv.style.visibility='hidden';
}

var COL=0;
var stopfade=false;
function fadeIn(fs) {
		ID=null;
		COL=0;
		oDv.style.visibility='visible';
		fadeIn2(fs);
}

function fadeIn2(fs) {
		COL=COL+fs;
		COL=(COL>1)?1:COL;
		oDv.style.filter='alpha(opacity='+parseInt(100*COL)+')';
		oDv.style.opacity=COL;
		if (COL<1)
		 setTimeout("fadeIn2("+fs+")",20);		
}


function fadeOut() {
	oDv.style.visibility='hidden';
	
}

function isChild(s,d) {
	while(s) {
		if (s==d) 
			return true;
		s=s.parentNode;
	}
	return false;
}

var cSrc;
function checkMove(e) {
	e?evt=e:evt=event;
	cSrc=evt.target?evt.target:evt.srcElement;
	if ((!boxMove)&&(!isChild(cSrc,oDv))) {
		fadeOut();
		if (CBE&&CBE.IEbugfix) {showSelects();}
		boxMove=true;
		CBE=null;
	}
}

function showSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
      elements[i].style.visibility='visible';
   }
}

function hideSelects(){
   var elements = document.getElementsByTagName("select");
   for (i=0;i< elements.length;i++){
   elements[i].style.visibility='hidden';
   }
}










// end



function add_Validator(theForm){

	if (theForm.username.value.length < 5)  {
	document.forms['addup'].tttt.value = 'שם משתמש קצר מדי.';
	document.forms['addup'].tttt.style.display ="";
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	theForm.username.focus();
	return (false);
	}

	if (theForm.pass.value.length < 6)  {
	document.forms['addup'].tttt.value = 'סיסמא קצרה מדי.';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.pass.focus();
	return (false);
	}
	if (theForm.pass.value != theForm.pass2.value)  {
	document.forms['addup'].tttt.value = 'אישור סיסמא שגוי';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.pass2.focus();
	return (false);
	}

	if (theForm.email.value.length < 10)  {
	document.forms['addup'].tttt.value = 'כתובת מייל לא תקינה.';
	document.forms['addup'].tttt.style.display ="";
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	theForm.email.focus();
	return (false);
	}

	if (!emailCheck(theForm.email.value))  {
	document.forms['addup'].tttt.value = 'כתובת מייל לא תקינה.';
	document.forms['addup'].tttt.style.display ="";
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	theForm.email.focus();
	return (false);
	}

	if (theForm.street_address.value.length < 6)  {
	document.forms['addup'].tttt.value = 'ערך כתובת למשלוח חשבונית לא תקין.';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.street_address.focus();
	return (false);
	}

	if (theForm.company_Contact.value.length < 6)  {
	document.forms['addup'].tttt.value = 'שם איש קשר חובה';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.company_Contact.focus();
	return (false);
	}

	if (theForm.phone.value.length < 6)  {
	document.forms['addup'].tttt.value = 'טלפון לא תקין.';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.phone.focus();
	return (false);
	}

	if (theForm.security_code.value == "")  {
	document.forms['addup'].tttt.value = 'קוד אימות משתמש שגוי.';
	document.forms['addup'].submit.value ='לסיום ההרשמה';
	document.forms['addup'].tttt.style.display ="";
	theForm.security_code.focus();
	return (false);
	}

}

function emailCheck(emailStr) {
var checkTLD=1;
var knownDomsPat=/^(com|net|org|il|uk|biz|co|numi|ac|tv|fm|mobi|tel|name|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=emailStr.match(emailPat);

if (matchArray==null) {
//	document.forms['faxup'].tttt.value = '.נא לבחור קובץ למשלוח';
alert("Email address seems incorrect (check @ and .'s)");
return false;
}

var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}

for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

if (user.match(userPat)==null) {
alert("The username doesn't seem to be valid.");
return false;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

if (len<2) {
alert("This address is missing a hostname!");
return false;
}
return true;
}


function fShowHide(eid) {
//document.forms['blah']
/* document.forms['faxup'].fax1.value = '';
document.forms['faxup'].fax19.value = '';
*/
for (var i=eid;i>=1111;i--) {
    document.getElementById('a'+i).style.display = "block";
}
for (var i=1140;i>eid;i--){
    document.getElementById('a'+i).style.display = "none";
}
}

function tttomer(inputValue,Idfax){
var phone2 = /^180[019][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone3 = /^1700[0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone4 = /^07[23467][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone5 = /^0[23489][013456789][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone6 = /^153[234689][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone11 = /^153[7][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
//                  7   7    7    9    2     7    3   2    7     
//document.forms['faxup'].tttt.value = 'מספר שגוי';
//0 77927327

// Eliran, 25/8/09 if (document.forms['faxup'].mobile.checked == 1){
var phone7 = /^153[5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone8 = /^0[5][0123456789][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
// }


// Eliran, 25/8/09 if (document.forms['faxup'].usa_canada.checked == 1){
var phone9 = /^001[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
// }
if (document.forms['faxup'].usa_canada.checked == 1){
var phone10 = /^01[2348][2-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
}

    document.getElementById('i'+Idfax).style.display = "block";
    document.getElementById('i'+Idfax+'ok').src = "images/ok.gif";
    document.getElementById('i'+Idfax+'ok').style.display = "none";

if (inputValue==''){
    document.getElementById('i'+Idfax).style.display = "block";
    document.getElementById('i'+Idfax+'ok').style.display = "none";
    document.getElementById('i'+Idfax).style.display = "none";
}
//inputValue=inputValue.replace(/\s+|-/g,"");
lengtha=inputValue.length;
output="";
        if (isNaN(inputValue)){
                for (pos=0;pos<=lengtha;pos++){
                char=inputValue.charAt(pos);
                	if (char>=0 && char<=9 && char!=" "){
                	        output=output+char;
                	}
                }
inputValue=output;
document.getElementById(Idfax).value=inputValue;

        }



// if (isNaN(inputValue))  {
//document.forms['faxup'].tttt.value = '.מספר הטלפון יכול להכיל ספרות בלבד';
//document.forms['faxup'].tttt.style.display ="none"
//document.forms['faxup'].submit.value ='שלחו פקס';
//    theForm.fax.focus();
//    return (false);
//  }

	if (inputValue.match(phone2)) {
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
 	} else if (inputValue.match(phone3)) {
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
 	} else if (inputValue.match(phone4)) {
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
 	} else if (inputValue.match(phone5)) {
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
 	} else if (inputValue.match(phone6)) {
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
 	} else if (inputValue.match(phone7)) {
    document.getElementById('i'+Idfax+'ok').src = "images/mobile.gif";
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
	} else if (inputValue.match(phone8)) {
    document.getElementById('i'+Idfax+'ok').src = "images/mobile.gif";
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
	} else if (inputValue.match(phone9)) {
    document.getElementById('i'+Idfax+'ok').src = "images/english.png";
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
	}else if (inputValue.match(phone10)) {
    document.getElementById('i'+Idfax+'ok').src = "images/europe.jpeg";
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;
	} else if (inputValue.match(phone11)) {
//    document.getElementById('i'+Idfax+'ok').src = "images/europe.jpeg";
    document.getElementById('i'+Idfax+'ok').style.display = "block";
    document.getElementById('i'+Idfax).style.display = "none";
//document.forms['faxup'].tttt.value = inputValue;
//   		return true;

	} else {

 	}
//document.getElementById(Idfax).value=inputValue;
document.forms['faxup'].tttt.value="";
document.forms['faxup'].tttt.style.display ="none"
	
}



function tttomer1(inputValue,Idfax){
var phone2 = /^180[019][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone3 = /^1700[0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone4 = /^07[23467][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone5 = /^0[23489][013456789][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone6 = /^153[2346789][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 

var phone11 = /^153[7][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 


// Eliran, 25/8/09 if (document.forms['faxup'].mobile.checked == 1){
var phone7 = /^153[5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
var phone8 = /^0[5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
// }

// Eliran, 25/8/09 if (document.forms['faxup'].usa_canada.checked == 1){
var phone9 = /^001[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
		
// }



	if (inputValue.match(phone2)) {
//    document.getElementById('i'+Idfax+'ok').style.display = "block";
//    document.getElementById('i'+Idfax).style.display = "none";
//    document.forms['faxup'].tttt.value = inputValue;
   		return (true);
 	} else if (inputValue.match(phone3)) {

   		return (true);
 	} else if (inputValue.match(phone4)) {

   		return (true);
 	} else if (inputValue.match(phone5)) {

   		return (true);
 	} else if (inputValue.match(phone6)) {

   		return (true);
 	} else if (inputValue.match(phone7)) {

   		return (true);
	} else if (inputValue.match(phone8)) {

   		return (true);
	} else if (inputValue.match(phone9)) {

   		return (true);
	} else if (inputValue.match(phone11)) {

   		return (true);
	} else {
 		return (false);
 	}


}



function isfilename(file){
  var result = false;
  var theStr1 = file;
  var theStr = theStr1.toLowerCase();
document.forms['faxup'].format.value='docx';

  var index = theStr.split(".");
i = index.length;
i=i-1;
var format = index[i];
  if (index[i] === "vsd")
  {
document.forms['faxup'].format.value="vsd";
	result = true;
  }
  if (index[i] === "mpp")
  {
document.forms['faxup'].format.value="mpp";
	result = true;
  }
  if (index[i] === "xml")
  {
document.forms['faxup'].format.value="xml";
	result = true;
  }
  if (index[i] === "dia")
  {
document.forms['faxup'].format.value="dia";
	result = true;
  }
  if (index[i] === "abw")
  {
document.forms['faxup'].format.value="abw";
	result = true;
  }
  if (index[i] === "bmp")
  {
document.forms['faxup'].format.value="bmp";
	result = true;
  }
  if (index[i] === "tif")
  {
document.forms['faxup'].format.value="tif";
	result = true;
  }
  if (index[i] === "tiff")
  {
document.forms['faxup'].format.value="tiff";
	result = true;
  }
  if (index[i] === "gif")
  {
document.forms['faxup'].format.value="gif";
	result = true;
  }
  if (index[i] === "jpg")
  {
document.forms['faxup'].format.value="jpg";
	result = true;
  }
  if (index[i] === "jpeg")
  {
document.forms['faxup'].format.value="jpeg";
	result = true;
  }
  if (index[i] === "png")
  {
document.forms['faxup'].format.value="png";
	result = true;
  }
  if (index[i] === "odt")
  {
document.forms['faxup'].format.value="odt";
	result = true;
  }
  if (index[i] === "pdf")
  {
document.forms['faxup'].format.value="pdf";
	result = true;
  }
  if (index[i] === "doc")
  {
document.forms['faxup'].format.value="doc";
	result = true;
  }
  if (index[i] === "docx")
  {
document.forms['faxup'].format.value='docx';
	result = true;
  }
  if (index[1] === "xls")
  {
document.forms['faxup'].format.value="xls";
	result = true;
  }
  if (index[1] === "xlsx")
  {
document.forms['faxup'].format.value="xlsx";
	result = true;
  }
  if (index[1] === "ppt")
  {
document.forms['faxup'].format.value="ppt";
	result = true;
  }
  if (index[1] === "pptx")
  {
document.forms['faxup'].format.value="pptx";
	result = true;
  }
  if (index[1] === "odp")
  {
document.forms['faxup'].format.value="odp";
	result = true;
  }
  if (index[1] === "ods")
  {
document.forms['faxup'].format.value="ods";
	result = true;
  }
  if (index[1] === "rtf")
  {
document.forms['faxup'].format.value="rtf";
	result = true;
  }
  if (index[1] === "html")
  {
document.forms['faxup'].format.value="html";
	result = true;
  }
  if (index[1] === "htm")
  {
document.forms['faxup'].format.value="htm";
	result = true;
  }
  //return result;
  if(result == false)
  {
	  
	 
	 G$('UpperError').innerHTML = "הקובץ שנבחר אינו מסוג נתמך, נסו קובץ אחר.";
	 G$('ff').style.border= "solid";
	 G$('ff').style.borderColor= "red";
	  
	 
  }
  else
  {
	  G$('UpperError').innerHTML = "";
	  G$('ff').style.border= "";
	  G$('ff').style.borderColor= "";
  }
  return result;
}


function form1_Validator(theForm){
document.forms['faxup'].submit.value ='המתן בבקשה';
document.forms['faxup'].tttt.value = '';
document.forms['faxup'].tttt.style.display ="none"

	
	if (theForm.file.value == "")  {
	document.forms['faxup'].tttt.value = '.נא לבחור קובץ למשלוח';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.file.focus();
	return (false);
	}


	if (!isfilename(theForm.file.value))  {
	document.forms['faxup'].tttt.value = '.סוג הקובץ שנבחר אינו תקין';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.file.focus();
	return (false);
	}


	if (theForm.file.value.length < 5)  {
	document.forms['faxup'].tttt.value = '.סוג הקובץ שנבחר אינו תקין';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.file.focus();
	return (false);
	}
	  if (!(theForm.Yes.checked == 1)){
		  document.forms['faxup'].tttt.value = '.חובה לקרוא ולאשר תקנון';
		  document.forms['faxup'].tttt.style.display ="";
		  document.forms['faxup'].submit.value ='שלחו פקס';
		      theForm.Yes.focus();
		      return (false);
		    }
	 e = document.getElementById("inner").value;
		if(e.length > 0 )
		{
			return true;
		}

	if (isNaN(theForm.fax0.value))  {
	document.forms['faxup'].tttt.value = '.מספר הטלפון יכול להכיל ספרות בלבד';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.fax0.focus();
	return (false);
	}


	if (theForm.fax0.value.length < 9)  {
	document.forms['faxup'].tttt.value = '.מספר הפקס שהוקש אינו תקין';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.fax0.focus();
	return (false);
	}


	if (!tttomer1(theForm.fax0.value,'fax')){
	document.forms['faxup'].tttt.value = '.מספר הפקס שהוקש אינו תקין בשדה 1';
	document.forms['faxup'].submit.value ='שלחו פקס';
	document.forms['faxup'].tttt.style.display ="";
	theForm.fax0.focus();
	return (false);
	}
/*
if (theForm.security_code.value == "")  {
document.forms['faxup'].tttt.value = '.קוד אימות משתמש שגוי';
document.forms['faxup'].submit.value ='שלחו פקס';
document.forms['faxup'].tttt.style.display ="";
    theForm.security_code.focus();
    return (false);
}
*/


if (!(theForm.fax1.value=="")){
	if (!tttomer1(theForm.fax1.value,'fax1')){
	document.forms['faxup'].tttt.value = '.מספר הפקס שהוקש אינו תקין בשדה 2';
	document.forms['faxup'].submit.value ='שלחו פקס';
	document.forms['faxup'].tttt.style.display ="";
	theForm.fax1.focus();
	return (false);
	}
}

	if (theForm.fax0.value == theForm.fax1.value ||theForm.fax0.value == theForm.fax2.value ||theForm.fax0.value == theForm.fax3.value ||theForm.fax0.value == theForm.fax4.value ||theForm.fax0.value == theForm.fax5.value ||theForm.fax0.value == theForm.fax6.value ||theForm.fax0.value == theForm.fax7.value ||theForm.fax0.value == theForm.fax8.value ||theForm.fax0.value == theForm.fax9.value){
	document.forms['faxup'].tttt.value = '.יש מספר פקס החוזר על עצמו או יותר';
	document.forms['faxup'].tttt.style.display ="";
	document.forms['faxup'].submit.value ='שלחו פקס';
	theForm.fax0.focus();
	return (false);
	}




if (!(theForm.fax9.value=="")){
if (!tttomer1(theForm.fax9.value,'fax9')){
document.forms['faxup'].tttt.value = '.מספר הפקס שהוקש אינו תקין בשדה 10';
document.forms['faxup'].submit.value ='שלחו פקס';
document.forms['faxup'].tttt.style.display ="";
    theForm.fax9.focus();
    return (false);
}



if (theForm.fax9.value == theForm.fax10.value ||theForm.fax9.value == theForm.fax10.value){
document.forms['faxup'].tttt.value = '.יש מספר פקס החוזר על עצמו או יותר';
document.forms['faxup'].tttt.style.display ="";
document.forms['faxup'].submit.value ='שלחו פקס';
    theForm.fax9.focus();
    return (false);
 	 	} 
}






  return openWin();
 
}
//oran

function IsNumeric(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 GetExc(Maxexcl)
{
	
	ee = document.getElementById("inner");
	ee.style.display = "block";
	var checkifempty =document.getElementById('exc').value;
	G$('ManualRemove').style.display = "none"; // remove list manual numbers 
	if(checkifempty != "")
	{
	//var disp =document.getElementById('a1111');
	//disp.style.display = "none";
	

	//var disp2 =document.getElementById('numberfax');
	//disp2.style.display = "none";
	var faxtosend = document.getElementById("faxtosend");
	faxtosend.innerHTML = ""; // שורות שנקלטו
	}
var undifsign = 0;
var d =document.getElementById('exc').value;

	if(d == "")
	{
		undifsign = 1;
	}

//	var re = new RegExp(" +");
var exclstr = new Array();
//exclstr = d.split(re);
//d = d.replace((/[\r\n]/g," ");
function removeSpaces(string) {
	 return string.split(' ').join('');
	}

d = removeSpaces(d);


d  = d.replace(/[\r|\n]/g," ");


d = d.replace(/[^ 0-9]/g,"");


 exclstr=  d.match(/[0-9][0-9][0-9][0-9][0-9]+/g);   // /\b\d+\b/g  // [0-9][0-9][0-9][0-9][0-9]+


// remove empty vars  before all checks 

 //var StartExl = exclstr.length;
exclstr.splice(Maxexcl,exclstr.length);
var EndExl = exclstr.length;
// only numbers
for(var i=0; i<exclstr.length;i++ )
{
	
	
	if(exclstr[i].length < 9)
	{
		 exclstr.splice(i,1);
		   EndExl--;
	}
	 var reg = regularcheck(exclstr[i]);
	   if(reg == false)
	   {
		  
		   exclstr.splice(i,1);
		   EndExl--;
		   
	   }
	   
  // var res = IsNumeric(exclstr[i]);
   //if(res == false )
   //{

   //exclstr.splice(i,1);
   //EndExl--;
   //}


   if(i >= Maxexcl)
   {
   exclstr.splice(i,1);
   EndExl--;
   }
  
   
  
}

// end only numbers 
// make uniqe
//exclstr = unique(exclstr);
var newArray=new Array();
label:for(var dd=0; dd<exclstr.length;dd++ )
{  
    for(var j=0; j<exclstr.length;j++ )
    {
        if(newArray[j]==exclstr[dd]) 
        {
        	EndExl--;
            continue label;
        }
    }
    newArray[newArray.length] = exclstr[dd];
    
    
}

exclstr =  newArray;
// end uniqe
// limit array size to 500

//end limit


// put end/start res
if(undifsign == 0)
{
	

var startres = document.getElementById("startres");
startres.style.display = "block";
//startres.innerHTML = "שורות שנקלטו : " + StartExl;

var end = document.getElementById("endres");
end.style.display = "block";
end.innerHTML = "מספרים תקינים שנקלטו : " + EndExl;
// end
  //alert(exclstr);
var e;
var inputs;

e = document.getElementById("inner");
if(exclstr[0] != undefined && exclstr[0] != "")
{
inputs = "<tr><td><input type='text' id='exclc' name='excl[]' value="+exclstr[0]+" size='14' maxlength='15' /><br /></td></tr> ";
}
else
{
	inputs = "";
}

for(var cc=1; cc<exclstr.length;cc++ )
{
	
	if(exclstr[cc] != undefined && exclstr[cc] )
	{
		
	inputs += "<tr><td><input type='text' name='excl[]' value="+exclstr[cc]+" size='14' maxlength='15' /><br /></td></tr> ";
	}
	else
	{
		inputs += "";
	}
	
}
	
	e.innerHTML = inputs;

	
}
// 

//
}

function regularcheck(number)
{
	var phone2 = /^180[019][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	var phone3 = /^1700[0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	var phone4 = /^07[23467][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	var phone5 = /^0[23489][013456789][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	var phone6 = /^153[2346789][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 

	var phone11 = /^153[7][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 


	// Eliran, 25/8/09 if (document.forms['faxup'].mobile.checked == 1){
	var phone7 = /^153[5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	var phone8 = /^0[5][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	// }

	// Eliran, 25/8/09 if (document.forms['faxup'].usa_canada.checked == 1){
	var phone9 = /^001[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/; 
	

	// }



		if (number.match(phone2)) {
//	    document.getElementById('i'+Idfax+'ok').style.display = "block";
//	    document.getElementById('i'+Idfax).style.display = "none";
//	    document.forms['faxup'].tttt.value = inputValue;
	   		return (true);
	 	} else if (number.match(phone3)) {

	   		return (true);
	 	} else if (number.match(phone4)) {

	   		return (true);
	 	} else if (number.match(phone5)) {

	   		return (true);
	 	} else if (number.match(phone6)) {

	   		return (true);
	 	} else if (number.match(phone7)) {

	   		return (true);
		} else if (number.match(phone8)) {

	   		return (true);
		} else if (number.match(phone9)) {

	   		return (true);
		} else if (number.match(phone11)) {

	   		return (true);
		}
		 else {
	 		return (false);
	 	}

}

function ClearExl()
{

	
	//var disp =document.getElementById('a1111');
	//disp.style.display = "block";
	G$('ManualRemove').style.display = ""; // add list manual numbers 
	var disp1 =document.getElementById('startres');
	disp1.style.display = "none";
	var disp2 =document.getElementById('endres');
	disp2.style.display = "none";
	//var disp3 =document.getElementById('numberfax');
	//disp3.style.display = "block";
	//var disp2 =document.getElementById('numberfaxs');
	//disp2.style.display = "block";
	
	var rr;
	var ee;
	rr = document.getElementById("exc").value = "";
	
	ee = document.getElementById("inner");
	ee.style.display = "none";
	ee.innerHTML = "";
	var faxtosend = document.getElementById("faxtosend");
	faxtosend.innerHTML = ""; // מספרי פקס למשלוח
	
	
}

// style="width: 20px; height: 20px;"

var t=setTimeout("otherbroswers()",300);
function otherbroswers()
{
	var browserName=navigator.appName; 
	var types = document.getElementById('exc');
	var types1 = document.getElementById('rec');
	var types2 = document.getElementById('crec');
if (browserName != "Microsoft Internet Explorer")
{
	
	//types.style.width = "20px";
	//types.style.height = "15px";
	
	types1.style.width = "40px";
	types1.style.height = "22px";
	types2.style.width = "40px";
	types2.style.height = "22px";
	
	
}
else
	{
		G$('file').size = "21";
		G$('Span').style.paddingLeft = "10px";
		G$('exc').style.height = '30px';
	}
}
