// search form
function sendSearch(tdID)
{
	var strSearch
	strSearch = document.getElementById(tdID).value
	window.location.href = 'search.asp?searchStr='+strSearch+'';
}

// open the product page
function openProduct (prodID, prods)
{
	var source = 'product.asp?ID='+prodID+'&Products='+prods
	win = window.open(source, "productPage", "top=5, left=5, width=555, height=480, status=no, resizable, scrollbars=auto")
	window.focus;
}

// chage the screen size for product
function changeScreenSize(pic_name)
{
	picture= new Image()
	picture.src=pic_name;
	window.resizeTo(555,picture.height+200);
}

// over the top
function overMenu(tdID,colorBg,colorTxt)
{
	// for menu sub menu display in flats for sale
	if (colorBg!='')
		document.getElementById(tdID).style.backgroundColor = colorBg;
	if (colorTxt!='')
		document.getElementById(tdID).style.color = colorTxt;
}

// out the top menu
function outMenu(tdID,colorBg,colorTxt)
{
	if (colorBg!='')
		document.getElementById(tdID).style.backgroundColor = colorBg;
	if (colorTxt!='')
		document.getElementById(tdID).style.color = colorTxt;
}

// switch main image src - meuchlas.asp
function galleryImg(ImgSrc,ImgBig,titleImg)
{
	var strHTML = '';
	//strHTML += '<a href="'+ImgBig+'" rel="lightbox" title="'+titleImg+'">';
	strHTML += '<img id="mainImg" class="middleImg" style="cursor:auto;" alt="'+titleImg+'" src="'+ImgSrc+'">';
	//strHTML += '</a>';
	//alert(strHTML);
	document.getElementById('loadarea').innerHTML = strHTML;
}

// 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')
}

// check information form
function checkForm()
{
	var fdbck = document.appForm;
	var mail = document.appForm.email.value;
	var x = mail.indexOf ("@");
	var y = mail.indexOf (".");
	
	if (fdbck.fname.value==""){
		fdbck.fname.style.backgroundColor="red";
		return
	}
	
	if (fdbck.tel.value==""){
		fdbck.tel.style.backgroundColor="red";
		return
	}
		
	if (mail=='') {
		fdbck.email.style.backgroundColor="red";
		return;
	}
	
	else if (x==-1 || y==-1) {
		fdbck.email.value = 'e-mail not valid';
		return;
	}
	
	fdbck.submit();
	
}

// open big picture
function openBig(picN)
{
	var source = 'bigPic.asp?picN='+ picN;
	win = window.open(source, "galleryBig", "top=0, left=0, width=350, height=400, status=no, resizable, scrollbars=yes")
	window.focus;
}


// open in parent window for popUp
function openInParent(src)
{
	window.opener.location.href = src;
	//window.close();
}

// hide all divs on onload
function hideDivs()
{
	var arrayOfDivs = document.all.tags("div");
	for (i=0 ; i< arrayOfDivs.length ; i++) {
		arrayOfDivs[i].style.visibility = 'hidden';
	}
}



// handle the sub menu opener
function dispSub(id,status,pos)
{
	var leftPos = ((screen.width-528)/2)+pos;
	document.all[id].style.left=leftPos;
	document.all[id].style.visibility=status;
}


// handle the menu over
function menuOver(id,img,fld)
{
	document.all[id].src = eval(img);
	document.all[fld].style.borderColor = '#751119';
}

// handle the menu out
function menuOut(id,img,fld)
{
	document.all[id].src = eval(img);
	document.all[fld].style.borderColor = '#A2A2A2';
}

// handle the Sub menu over
function menuOverSub(id,img)
{
	document.all[id].src = eval(img);
}

// display image on mifrat
function imgMifrat(title,imgName,folderName)
{
	if (imgName != '')
	{
		document.getElementById('titleMifrat').innerHTML = title;
		document.getElementById('imgMifrat').src = 'images/gallery/'+folderName+'/mifrat/'+imgName;
	}
	else
	{
		document.getElementById('titleMifrat').innerHTML = title;
		document.getElementById('imgMifrat').src = 'images/pix.gif';
	}
		document.getElementById('imgMifrat').filters[0].apply()
		document.getElementById('imgMifrat').style.visibility="visible"
		document.getElementById('imgMifrat').filters[0].play()
}

// display image + pdf on plans
function imgPlan(title,imgName,folderName,pdfName,txtLink)
{
	if (imgName != '')
	{
		document.getElementById('titleMifrat').innerHTML = title;
		document.getElementById('imgMifrat').src = 'images/gallery/'+folderName+'/plans/'+imgName;
	}
	else
	{
		document.getElementById('titleMifrat').innerHTML = title;
		document.getElementById('imgMifrat').src = 'images/pix.gif';
		document.getElementById('imgMifrat').style.width = '230px';
	}

		document.getElementById('imgMifrat').filters[0].apply()
		document.getElementById('imgMifrat').style.visibility="visible"
		document.getElementById('imgMifrat').filters[0].play()
		
	if (pdfName != '')
	{
		var strTxtLink;
		if (txtLink == 'En')
			strTxtLink = 'Click here for Enlargment and pdf download'
		else
			strTxtLink = 'להגדלה ולהורדת קובץ pdf לחץ כאן'
		
		document.getElementById('pdfLink').innerHTML = '<a href="images/gallery/'+folderName+'/plans/'+pdfName+'" class="builder" target="_blank">'+strTxtLink+'</a>';
		
	}
	else
	{
		document.getElementById('pdfLink').innerHTML = '<br>';
	}
}

// display flash on views
function imgFlash(title,flashFile,folderName)
{
	var strFlash;
	strFlash = '<script type="text/javascript">AC_FL_RunContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width","400","height","300","align","center","src","images/gallery/'+folderName+'/flats/'+flashFile+'","quality","high","bgcolor","#FFFFFF","name","images/gallery/'+folderName+'/flats/'+flashFile+'","allowscriptaccess","sameDomain","pluginspage","http://www.macromedia.com/go/getflashplayer","movie","images/gallery/'+folderName+'/flats/'+flashFile+'");</script>'
	alert(strFlash);
	document.getElementById('titleMifrat').innerHTML = title;
	document.getElementById('imgMifrat').innerHTML = '<script type="text/javascript">AC_FL_RunContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0","width","400","height","300","align","center","src","images/gallery/'+folderName+'/flats/'+flashFile+'","quality","high","bgcolor","#FFFFFF","name","images/gallery/'+folderName+'/flats/'+flashFile+'","allowscriptaccess","sameDomain","pluginspage","http://www.macromedia.com/go/getflashplayer","movie","images/gallery/'+folderName+'/flats/'+flashFile+'");</script>'
}

var lastID = 0;

// display the product
function displayProduct(itemID, imgBig)
{
	document.getElementById("link"+lastID).className = 'iconHolder';
	document.getElementById("imgHolder").src = "images/prods/" + imgBig ;
	document.getElementById("txtHolder").innerHTML = icons[itemID];
	document.getElementById("link"+itemID).className = 'iconHolderSelected';
	lastID = itemID;
}

// display the Watches
function displayWatches(itemID, imgBig, addImg)
{
	document.getElementById("link"+lastID).className = 'iconHolder';
	document.getElementById("imgHolder").src = "images/prods/" + imgBig ;
	document.getElementById("txtHolder").innerHTML = icons[itemID];
	if (addImg != '')
		document.getElementById("moreImg").src = "images/prods/" + addImg;
	else
		document.getElementById("moreImg").src = "images/prods/pix.gif";
	document.getElementById("link"+itemID).className = 'iconHolderSelected';
	lastID = itemID;
}

// display the bracelets
function displayBracelets(itemID, imgBig, addImg)
{
	document.getElementById("link"+lastID).className = 'iconHolder';
	document.getElementById("imgHolder").src = "images/prods/" + imgBig ;
	document.getElementById("txtHolder").innerHTML = icons[itemID];
	if (addImg != '')
		document.getElementById("moreImg").src = "images/prods/" + addImg;
	else
		document.getElementById("moreImg").src = "images/prods/pix.gif";
	document.getElementById("link"+itemID).className = 'iconHolderSelected';
	lastID = itemID;
}

