﻿
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;
	}
	
	location.href = "mailList.asp?kind=" + what + "&mail=" + mail;
}


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 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 send to registration form
function openRequest(itemID, typeID)
{
	var win
	var source = 'regisForm.asp?id=' + itemID + '&type=' + typeID
	win = window.open(source, 'regisForm', 'top=5, left=5, width=320, height=450, status=no, resizable')
}

// 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")
}



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;
}


var load1=new Image();	//pre-load images of icons in menu
load1.src="images/ButTop800On.jpg";
var load2=new Image();
load2.src="images/ButTop800.jpg";
var load3=new Image();
load3.src="images/BgButOn.jpg";
var load4=new Image();
load4.src="images/BgBut.jpg";

function changeIcon(tdID,tdBack) 
{
document.getElementById(tdID).src = load1.src;
document.getElementById(tdBack).background = "images/BgButOn.jpg";
}

// mouse out menu
function returnIcon(tdID,tdBack) 
{
document.getElementById(tdID).src = load2.src;
document.getElementById(tdBack).background = load4.src;
}
