function CheckUrl(){
	var URL=location.href;
	if(URL.substr(0,10)!="http://www"){		window.location.href="http://www.nitzotzotonline.com/";
	}
}
function Change(id,outer,inner,where)
{
if (where==""){where="index";}
	document.form1.id.value=id;
	document.form1.Mid.value=outer;
	document.form1.valCat.value=inner;
	//document.form1.leftS.value=lft;
	document.form1.action="http://www.nitzotzotonline.com/"+where+".php";
	document.form1.submit();
}
function findt1(id,outer,inner,lft,where)
{
	document.form1.id.value=id;
	document.form1.Mid.value=outer;
	document.form1.valCat.value=inner;
	document.form1.leftS.value=lft;
	document.form1.action="http://www.nitzotzotonline.com/"+where+".php";
	document.form1.submit();
}
function openwin(strs,ids,scroll,w,h){
var mynewwind=window.open(strs+"?pic="+ids,'mynewwind','width='+w+',height='+h+',top=200,left=300,resizable=no, scrollbars='+scroll+',toolbar=no,channelmode=no,fullscreen=no');}
function openwinRes(strs,ids,scroll,w,h)
{
var mynewwind=window.open(strs+"?pic="+ids,'mynewwind','width='+w+',height='+h+',top=200,left=300,resizable=1, scrollbars='+scroll+',toolbar=no,channelmode=no,fullscreen=no');}
function IfNotSelected(id,msg) {;
var bReturn = false;
var rd=getr(document.form1.rd1);
if(rd!=null)
	bReturn =true;
if (!bReturn){alert(msg);}
else {Change(id,rd,"PollResl","PollResults");}
}

function getr(radio1)
{
var value=null;
for (var i=0;i<radio1.length;i++){
	if(radio1[i].checked){value=radio1[i].value;break;}
	}
return value;
}
function twdCount(field,cntfield,maxlimit) {
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
else
cntfield.value = maxlimit - field.value.length;
}
function TextScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {
               div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
				div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

				div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
				div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
				//window.onload = function() { eval(scrollname + ".ScrollUpLitle();") };
            }
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

this.scrollDown = function() {
		if (this.div_obj) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = this.scrollCursor;
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
			} else {
			this.scrollCursor = this.div_obj.scrollTop;
			}
		}
	}

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }

this.ScrollUpLitle = function() {
        if (this.div_obj) {
			this.scrollCursor += this.speed;
			this.div_obj.scrollTop = 500;
			if (this.div_obj.scrollTop == this.scrollCursor) {
				this.timeoutID = setTimeout(this.name + ".ScrollUpLitle()", 60);
			}
		}
    }

}
function SearchMe() {
if(document.getElementById("q").value==""){Change('','IndexMain','0','Indexes');}
else
Change('','IndexSearch','0','Indexes')
}
function lot(where,the,ct,num)
{
	window.open(where+".php?id="+the+"&link="+ct+"&num="+num,'','resizable=1,scrollbars=1,titlebar=1,addressbar=1,menubar=1,toolbar=1');
}
function thedate(d1,d2)
{
var a1,a2;
var today=new Date();
a2=today.getFullYear();
a1=today.getMonth();
a1=a1+1;
if (d1>=a1 && d2>=a2)
	{return ff=true;}
else
if (d1<a1 && d2>a2)
	{return ff=true;}
else
	{return ff=false;}
}
function stringFilter (input,sts)
{s = input.value;
filteredValues = sts;
var i,f,d;
var returnString = "";
for (i = 0; i < s.length; i++) {
	var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1)
	returnString += c;
}f = returnString;
if (f=="")
	return  d=true;
}
function Submit(Mid,WhereTo){
var at=document.form1.email.value.indexOf("@");
var dot=document.form1.email.value.indexOf(".");
if (document.form1.fname.value=="")
	{document.form1.fname.focus();
	alert("הקלד שם פרטי");}
else
if (document.form1.lname.value=="")
	{document.form1.lname.focus();
	alert("הקלד שם משפחה");}
else
if(document.form1.email.value==""){
	alert("הקלד כתובת אימייל");
	document.form1.email.focus();}
else
if((at==-1)||(dot==-1)){
	alert("כתובת האימייל אינה נכונה - בדוק שוב");
	document.form1.email.focus();}
else
if(document.form1.address.value==""){
	alert("הקלד כתובת");
	document.form1.address.focus();}
else
if(document.form1.city.value==""){
	alert("הקלד עיר מגורים");
	document.form1.city.focus();}
else
if(document.form1.phone.value==""){
	alert("הקלד טלפון");
	document.form1.phone.focus();}
else
if (document.form1.phone.value!="" && !stringFilter(document.form1.phone,"1234567890-"))
	{document.form1.phone.focus();
	alert("הטלפון אינו תקין");}
else
if (document.form1.user.value=="")
	{document.form1.user.focus();
	alert("הקלד שם משתמש");}
else
if (!stringFilter(document.form1.user,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWZYZ"))
	{document.form1.user.focus();
	alert("שם משתמש באנגלית בלבד");}
else
if (document.form1.pass.value=="")
	{document.form1.pass.focus();
	alert("הקלד סיסמא");}
else
if (document.form1.pass1.value=="")
	{document.form1.pass1.focus();
	alert("הקלד סיסמא");}
else
if (document.form1.pass.value!=document.form1.pass1.value)
	{document.form1.pass1.focus();
	alert("הסיסמא אינה מתאימה");}
else
if (!document.form1.takanon.checked)
	{alert("נא לסמן כי קראת את התקנון והינך מסכים לתנאיו");}
else
{document.form1.Mid.value=Mid;
	document.form1.method="POST";
	document.form1.action="https://www.nitzotzotonline.com/" + WhereTo + ".php";
	document.form1.submit();}
}
function SubmitCred(WhereTo){
if (document.form1.card_name.value=="0"){
	alert("אנא בחר כרטיס אשראי");
	document.form1.card_name.focus();return false;}
else
if (document.form1.card_owner.value==""){
	alert("אנא מלא שם בעל הכרטיס");
	document.form1.card_owner.focus();return false;}
else
if (document.form1.id_num.value=="" || ! stringFilter (document.form1.id_num,"1234567890")){
	alert("אנא מלא מספר ת.ז - רק מספרים");
	document.form1.id_num.focus();return false;}
else
if (document.form1.card_num.value=="" || ! stringFilter (document.form1.card_num,"1234567890")){
	alert("אנא מלא מספר הכרטיס - רק מספרים");
	document.form1.card_num.focus();return false;}
else
if (!thedate(document.form1.validdate.value,document.form1.validdate1.value)){
	alert("כרטיס האשראי שלך פג תוקף - אנא בדוק שוב");return false;}
else
if (document.form1.backNum.value=="" || ! stringFilter (document.form1.backNum,"1234567890")){
	alert("אנא מלא את הספרות בגב הכרטיס");
	document.form1.backNum.focus();return false;}
else
{document.form1.Mid.value="";
	document.form1.method="POST";
	document.form1.action="https://www.nitzotzotonline.com/" +WhereTo + ".php";
	document.form1.submit();}
}
function CheckUserPass()
{    if (document.form1.userIn.value=="")
	{document.form1.userIn.focus();
	alert("הקלד שם משתמש");return false;}
else
if (document.form1.passIn.value=="")
	{document.form1.passIn.focus();
	alert("הקלד סיסמא");return false;}
else
	{		return true;	}}
function Save(){
var at=document.form1.email.value.indexOf("@");
var dot=document.form1.email.value.indexOf(".");
if (document.form1.fname.value=="")
	{document.form1.fname.focus();
	alert("הקלד שם מלא");}
else
if(document.form1.email.value==""){
	alert("הקלד כתובת אימייל");
	document.form1.email.focus();}
else
if((at==-1)||(dot==-1)){
	alert("כתובת האימייל אינה נכונה - בדוק שוב");
	document.form1.email.focus();}
else
if (document.form1.phone.value!="" && !stringFilter(document.form1.phone,"1234567890-"))
	{document.form1.phone.focus();
	alert("הטלפון אינו תקין");}
else
	{	 document.form1.newval.value="Saves";
	document.form1.submit();
	}
}
function FindMyPass() {	if (document.form1.userIn.value=="")
	{document.form1.userIn.focus();
	alert("הקלד שם משתמש");}
	else
	if (document.form1.passIn.value=="")
	{document.form1.passIn.focus();
	alert("הקלד סיסמא חדשה");}
	else
	{		document.form1.method="POST";
		document.form1.action="https://www.nitzotzotonline.com/Remind.php";
		document.form1.submit();
	}

}