function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  return foundObj;
}

/* BOOKMARK FUNCTION
 *
 * params:
 * title 	- the name of the bookmarj
 * url 		- the link
 */
function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}

function showhide(layer) {
	if (document.getElementById(layer).style.display=='block')
		document.getElementById(layer).style.display = 'none';
	else
		document.getElementById(layer).style.display = 'block';
}

function checkEmail() {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email1').value))
		return true;
	else
		alert("Invalid E-mail Address! Please re-enter.")
	return false;
}

function checkContact() {
	var msg = '';
	if (document.getElementById('cname').value=='')
		msg = msg + "חובה להזין שם\n";
	if (document.getElementById('ccontent').value=='')
		msg = msg + "חובה להזין את תוכן הפניה\n";
	if (document.getElementById('cemail').value=='')
		msg = msg + "חובה להזין כתובת דואר אלקטרוני\n";
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('cemail').value)) 
		msg = msg;
	else
		msg = msg + "כתובת הדואר האלקטרוני לא תקינה";
		
	if (msg=='') return true;
	alert(msg);
	return false;
}

function resizeURL()
{
	var width=640;
	var height=480;
	var arraySize = document.windowResizeForm.resolution.length;
	var tempValue='640x800';
	for (var i=0;i<arraySize;i++)
	{
		if (document.windowResizeForm.resolution[i].checked==true)
		{
			tempValue = (document.windowResizeForm.resolution[i].value);
		}
	}
	if (tempValue=='640x480')
	{
		width = 640;
		height = 480;
	}
	else if (tempValue=='800x600')
	{
		width = 800;
		height = 600;
	}
	else if (tempValue=='1024x768')
	{
		width = 1024;
		height = 768;
	}
	else if (tempValue=='1152x864')
	{
		width = 1152;
		height = 864;	
	}
	else if (tempValue=='1600x1200')
	{
		width = 1600;
		height = 1200;
	}
	var urlToResize = document.windowResizeForm.url.value;
	if (urlToResize.indexOf("://")==-1) {urlToResize="http://"+urlToResize};
	window.open(urlToResize,tempValue,'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width='+width+',height='+height);
}