// JavaScript Document
function show(elId)
{
	var el = document.getElementById(elId);
	el.style.display = "";
	
}
function hide(elId)
{
	var el = document.getElementById(elId);
	el.style.display = "none";
	
}
function toggle(elId)
{
	var el = document.getElementById(elId);
	el.style.display = (el.style.display == "none")? "":"none";
}
/* Open a Pop Up Window */
function openWin(winUrl,winName,winWidth,winHeihgt,winTop,winLeft,winMoreFeature)
{
	winFeature="";
	// Set default properties if not passed
	if(winName=="")
	{
		winName="FroviPopUp";
	}
	if(winWidth!="")
	{
		winFeature+="width="+winWidth+",";
	}
	if(winHeihgt!="")
	{
		winFeature+="height="+winHeihgt+",";
	}
	if(winTop!="")
	{
		winFeature+="screenY="+winTop+",";
	}
	if(winLeft!="")
	{
		winFeature+="screenX="+winLeft+",";
	}
	if(winMoreFeature!="")
	{
		winFeature+=winMoreFeature;
	}
	else
	{
		winFeature+="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes";
	}
	// If there is a url do pop up

	if(winUrl!="")
	{	
		popUpWin = window.open(winUrl,winName,winFeature)
	}
	else
	{
		return false;
	}
}





function validateEmail()
{
	var errorString 	= "";
	var recipientEmail 	= document.contactForm.elements["from"].value;
/*	var fullText 		= document.tipFriendForm.elements["message"].value; */

	if (recipientEmail == "")
	{
		errorString += "You left the 'From'-field empty.\n";
	}
	else
	{
		var regExp 		=  /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,4})+$/;
		var emailIsOk 	= regExp.test(recipientEmail);

		if (!emailIsOk)
		{
	       errorString += "The 'From'-field doesn't contain a correct e-mail address.\n";
	    }
	}

	if (errorString != "")
	{
		errorString = errorString+"If you did not leave any information how we can contact you it will be hard for us to answer questions. You may send this message anyway, but we recommend you to go back to the form and add your e-mail adress or phone number.\n\n";
		errorString = errorString+"Do you want to send this message anyway?";
		if (confirm(errorString)) {
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return true;
	}
}
