/*
######################################################################

 Project		:	originX
 Developer		:	originX
 Created		:	January 2006
 Updated		:	January 2006

 Overview		:	JavaScript Functions commonly used by originX
 					webEditor managed sites

 copyright (c) 2006 originX
 http://www.originx.com
 tech@originx.com

######################################################################
*/

// Form validation script (v1.0 01/06)
function oxsoValidateForm(strFormName)
{
	try
	{
		for (i=0;i < document.forms[strFormName].length;i++) 
		{
			if (document.forms[strFormName][i].required == "true")
			{
				strType = document.forms[strFormName][i].type;
				strName = document.forms[strFormName][i].name;
				
				switch (strType)
				{
					case "text":
					
						if (document.forms[strFormName][i].value == "")
						{
							alert("Please complete " + strName);
							document.forms[strFormName][i].focus();
							return false;
						}
						break;
						
					case "textarea":
					
						if (document.forms[strFormName][i].value == "")
						{
							alert("Please complete " + strName);
							document.forms[strFormName][i].focus();
							return false;
						}
						break;
						
					case "checkbox":
					
						if (document.forms[strFormName][i].checked == false)
						{
							alert("Please check " + strName);
							document.forms[strFormName][i].focus();
							return false;
						}
						break;
				}
			}
		}
	}
	catch(e)
	{
	
	}
	document.forms[strFormName].submit();
}


function oxsoEmailThisPage(strUrl)
{
	oxsoLaunchPopup("oxso_EmailThisPage.asp?Page="+strUrl, "winEmail", 380, 370, "");
}


function oxsoLaunchPopup(strLocation, strWindowName, iWidth, iHeight, strParameters)
{
	if (strWindowName.length == 0) {strWindowName = "_blank"}
	if (iWidth.toString().length == 0) {iWidth = 640}
	if (iHeight.toString().length == 0) {iHeight = 640}
	if (strParameters.length > 0)
		strParameters = strParameters + ",width=" + iWidth + ",height=" + iHeight
	else
		strParameters = "scrollbars" + ",width=" + iWidth + ",height=" + iHeight
	
	intLeft = (screen.availWidth - iWidth)/2;
	intTop = (screen.availHeight - iHeight)/2;

	strParameters = strParameters + ",left=" + intLeft + ",top=" + intTop
	
	window.focus();
	popupWin = window.open(strLocation, strWindowName, strParameters)
	popupWin.focus();
	return false;
}