function mailList(what)
{
	if (what==0)
		var mail = document.all.email2.value;
	else if (what==1)
		var mail = document.all.email.value;
		
	var x = mail.indexOf ("@");
	var y = mail.indexOf (".");
	
	if (mail=='') {
		if (what==0)
			document.all.email2.style.backgroundColor="red";
		else if (what==1)
			document.all.email.style.backgroundColor="red";
		return;
	}
	else if (x==-1 || y==-1) {
		if (what==0)
			document.all.email2.value = 'אי-מייל לא חוקי';
		else if (what==1)
			document.all.email.value = 'אי-מייל לא חוקי';
		return;
	}
	
	if (what==0)
		location.href = "mailList.asp?kind=" + what + "&mail=" + mail;
	else if (what==1)
		if (document.maillist.fname.value=='שם פרטי')
		{
			document.maillist.fname.value = '';
		}
		if (document.maillist.lname.value=='משפחה' || document.maillist.lname.value=='')
		{
			document.maillist.lname.value = document.maillist.fname.value;
		}
		if (document.maillist.tel.value=='טלפון ליצירת קשר')
		{
			document.maillist.tel.value = '';
		}
		document.maillist.submit();
	
}


// for question sending
function addQ ()
{
	win = window.open('sendQuestion.asp','AddQuestion', 'top=5, left=5,  height=500, width=400 , status=no, scrollbars=yes, resizable')
	win.focus();
}

// for course registration form
function openRegis (courseID)
{
	win = window.open('sendRegis.asp?id='+courseID,'regisForm', 'top=0, left=0,  height=650, width=500 , status=no, scrollbars=yes, resizable')
	win.focus();
}

// for lectures registration form
function openLecture (courseID)
{
	win = window.open('sendLecture.asp?id='+courseID,'regisForm', 'top=0, left=0,  height=650, width=500 , status=no, scrollbars=yes, resizable')
	win.focus();
}

// for course tour form
function openTour (courseID)
{
	win = window.open('sendTour.asp?id='+courseID,'regisForm', 'top=0, left=0,  height=650, width=500 , status=no, scrollbars=yes, resizable')
	win.focus();
}

// for dubon additional info
function openDubon (item)
{
	win = window.open('dubonWin.asp?id='+item, 'dubonForm', 'top=0, left=0,  height=650, width=500 , status=no, scrollbars=yes, resizable')
	win.focus();
}

function openMsg (id)
{
	var fileN = 'openMsg.asp?id='+id;
	win = window.open(fileN,'clientMsg', 'top=5, left=5,  height=300, width=300 , status=no, scrollbars=yes, resizable')
	win.focus();
}


// send search string
function testKeyDown()
{
	var x = event.keyCode;
	if (x == 13)
		goSearch();
}

// send search string
function goSearch()
{
	var str = document.getElementById("strSearch");
	if (str.value == '' || str.value == 'חיפוש באתר:' ) {
		str.style.backgroundColor="red";
		str.value = ''
		return
	}
	location.href = "search.asp?searchStr=" + str.value;
}


// check feedback form
function checkFeedback()
{
	var fdbck = document.feedback;
	var mail = document.feedback.email.value;
	var x = mail.indexOf ("@");
	var y = mail.indexOf (".");
	
	if (fdbck.fname.value==""){
		fdbck.fname.style.backgroundColor="red";
		return
	}
	if (fdbck.lname.value==""){
		fdbck.lname.style.backgroundColor="red";
		return
	}
	
	if (mail=='') {
		fdbck.email.style.backgroundColor="red";
		return;
	}
	else if (x==-1 || y==-1) {
		fdbck.email.value = 'אי-מייל לא חוקי';
		return;
	}
	
	fdbck.submit();
	
}

// send search string web
function testKeyDown3()
{
	var x = event.keyCode;
	if (x == 13)
		checkClient();
}

function checkClient()
{
	var client = document.sendClient;
	if (client.user.value == "") {
		client.user.style.backgroundColor="red";
		return
	}
	
	if (client.pass.value == "") {
		client.pass.style.backgroundColor="red";
		return
	}
	
	client.submit();
}

function testKeyDown4()
{
	var x = event.keyCode;
	if (x == 13)
		checkLimit();
}

function checkLimit()
{
	var client = document.userPass;
	if (client.user.value == "") {
		client.user.style.backgroundColor="red";
		return
	}
	
	if (client.pass.value == "") {
		client.pass.style.backgroundColor="red";
		return
	}
	
	client.submit();
}

function printDoc () 
{	
	window.print();
}

// open the window for picture navigation.	
function showGallery(imgPath,itemID,catID)
{
    var org = document.URL;
	var what = /&/g;
	var newStr = org.replace(what,'@@@');
	var source = 'bigGallery.asp?path='+ imgPath + '&id='+ itemID+'&cat='+ catID +'&urlPath=' + newStr;
	win = window.open(source, "galleryBig", "top=0, left=0, status=no, resizable, scrollbars=yes")
}

// open the window for big picture.	
function showBig (path,nameP) {
	var org = document.URL;
	var what = /&/g;
	var newStr = org.replace(what,'@@@');
	var source = 'imgBig.asp?path='+ path + '&name=' + nameP + '&urlPath=' + newStr;
	win = window.open(source, "imgBig", "top=0, left=0, status=no, resizable, scrollbars=yes")
}

// open the window for dubon.	
function showDubon (path,nameP) {
	var org = document.URL;
	var what = /&/g;
	var newStr = org.replace(what,'@@@');
	var source = 'imgDubon.asp?path='+ path + '&name=' + nameP + '&urlPath=' + newStr;
	win = window.open(source, "imgDubon", "top=0, left=0, status=no, resizable, scrollbars=yes")
}


// open print version window
function printDoc(kindRec,itemID)
{
	var win
	win = window.open('printDoc.asp?id='+itemID+'&kind='+kindRec , 'printDoc', 'top=5, left=5, width=660, height=430, status=no, resizable, scrollbars')
	win.focus()
}

// open send to friend window
function sendFriend(titleID)
{
	var win
	var titleStr = titleID.replace('"','``')
	var org = document.URL;
	var what = /&/g;
	var newStr = org.replace(what,'@@@');
	var source = 'sendFriend.asp?title=' + titleStr + '&urlPath=' + newStr;
	win = window.open(source, 'sendFriend', 'top=5, left=5, width=390, height=430, status=no, resizable')
	win.focus()
}

// open the window for big pictures.	
function openBig(path,nameP)
{
	var org = document.URL;
	var what = /&/g;
	var newStr = org.replace(what,'@@@');
	var source = 'imgBig.asp?path='+ path + '&name=' + nameP + '&urlPath=' + newStr;
	win = window.open(source, "imgBig", "top=0, left=0, status=no, resizable, scrollbars=yes")
}

// mouse over menu
//var load1=new Image();	//pre-load images for menu
//load1.src="images/bgOver.gif";
//var imgOver = load1.src;
//var load2=new Image();
//load2.src="images/bgOut.gif";
//var imgOut = load2.src;


function chgOver(tdID) {
newImage = "url(images/bgOver.gif)";
document.getElementById(tdID).style.backgroundImage = newImage;
}

// mouse over menu
function chgOut(tdID) {
newImage = "url(images/bgOut.gif)";
document.getElementById(tdID).style.backgroundImage = newImage;
}

