//function to show rollover of images
function rollOver(imName,over) 
{
	if (over) 
	{ 
		document.images[imName].src = "images/sitegraphics/" + imName + "a.gif"
	}
	else 
	{ 
		document.images[imName].src = "images/sitegraphics/" + imName + ".gif"
	}
}
function rollOverJigsaw(imName,over) 
{
	if (over) 
	{ 
		document.images[imName].src = "images/" + imName + "A.gif"
	}
	else 
	{ 
		document.images[imName].src = "images/" + imName + ".gif"
	}
}
function Is ()
{   var agt=navigator.userAgent.toLowerCase();

    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);

    this.nav  = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1)));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
    this.nav6up = (this.nav && (this.major >= 5));
    this.opera = (agt.indexOf("opera") != -1);
    this.opera7up = (this.opera && !this.opera2 && !this.opera3 && !this.opera4 && !this.opera5 && !this.opera6);
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie4up  = (this.ie && (this.major >= 4));

}
function popup(helpID)
{
	window.open('popup.asp?help='+helpID,'CreateIDHelp','width=400,height=400,scrollbars=yes,resizable=yes');
}

function popupuserguide()
{
	window.open('include/CREATEIDEditorUserGuide.doc','CreateIDHelp','scrollbars=yes,resizable=yes');
}

function displayOption(Option) {
/*	this function shows and hides a div or span
	the space taken up by the div or span does not show when hidden
	parameter:	option is the name of the div or span containing the item to show hide
				the option parameter should be passed WITHOUT quotes

	the item to be shown/hidden must be in a div or span element with an id equal to Option
	if your content is within a table, open and close the div or span tags outside the table
	the function won't work if the content is within a row where the  table declaration
	is outside of the div or span
	
*/
	Option.style.display = Option.style.display == "none" ? "" : "none";
}

function height() 
{
	/*This function detects the height of the page */
        if (document.all) 
           //alert('Document height = ' + document.body.offsetHeight);
		var menuht = (document.body.offsetHeight);
		return(menuht);
}

function openWin( windowURL, windowName, windowFeatures ) 
{ 
	return window.open( windowURL, windowName, 'width=700,height=550,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=0' ) ; 
} 
var objName
var objURL
// the initial value for these objects is set on the page that includes this javascript

function oKToDelete (refNumber)
{	// display a confirmation dialog to ensure user wishes to delete the specified object
	// loads refNumber into the objURL, before calling this RL to delete the object
	// if click OK, load the Main frame with objURL (objURL to handle deletion)
	// if click cancel, no action

	// generate the confirmation message
	deleteMessage = "CONFIRM DELETION\n\nDelete this " + objName + " permanently?"

	// display confirmation to user
	if (confirm (deleteMessage)) {
		// user has elected to delete this object
		objURL += refNumber
		location.href = objURL
	}
}

function oKToDeletePath (refNumber,refItem,refType)
{	// display a confirmation dialog to ensure user wishes to delete the specified object
	// loads refNumber into the objURL, before calling this RL to delete the object
	// if click OK, load the Main frame with objURL (objURL to handle deletion)
	// if click cancel, no action

	// generate the confirmation message
	deleteMessage = "CONFIRM DELETION\n\nDelete this " + objName + " permanently?"

	// display confirmation to user
	if (confirm (deleteMessage)) {
		// user has elected to delete this object
		objURL += refNumber
		objURL = objURL + "&itemid=" + refItem + "&itemType=" + refType
		location.href = objURL
	}
}

function oKToDissociate (refNumber)
{	// display a confirmation dialog to ensure user wishes to dissociate the specified object
	// loads refNumber into the objURL, before calling this RL to delete the object
	// if click OK, load the Main frame with objURL (objURL to handle deletion)
	// if click cancel, no action

	// generate the confirmation message
	dissociateMessage = "CONFIRM DISSOCIATION\n\nDissociate this " + objName + "?"

	// display confirmation to user
	if (confirm (dissociateMessage)) {
		// user has elected to dissoaciate this object
		objURL += refNumber
		location.href = objURL
	}
}
function CloseWin()
{
	newWindow.close()
}
function checkCalc(num)
{
	var alertStr = "";

	if (num==1)
	{
		var intAmount = document.calc.loanamt.value;
		if ((intAmount == "") || (isNaN(intAmount) == true))
		{
			alertStr = alertStr + "Please choose a valid loan amount.\n";
		}
		var intRate = document.calc.irate.value;
		if ((intRate == "") || (isNaN(intRate) == true))
		{
			alertStr = alertStr + "Please choose a valid interest rate.\n";
		}
		var intTerm = document.calc.term.value;
		if ((intTerm == "") || (isNaN(intTerm) == true))
		{
			alertStr = alertStr + "Please choose a valid term of loan.\n";
		}

	}

	if (alertStr != "")
	{
		alert("The details you have entered the calculator are incomplete.\nPlease complete the following:\n\n"+alertStr)
	}
	else
	{
		//alert("Submitting")
		document.calc.submit()
	}
}
function checkCalc2(num)
{
	var alertStr = "";

	if (num==1)
	{
		var intAmount = document.calc2.loanamt.value;
		if ((intAmount == "") || (isNaN(intAmount) == true))
		{
			alertStr = alertStr + "Please choose a valid loan amount.\n";
		}
		var intRate = document.calc2.irate.value;
		if ((intRate == "") || (isNaN(intRate) == true))
		{
			alertStr = alertStr + "Please choose a valid interest rate.\n";
		}
		var intTerm = document.calc2.term.value;
		if ((intTerm == "") || (isNaN(intTerm) == true))
		{
			alertStr = alertStr + "Please choose a valid term of loan.\n";
		}

	}

	if (alertStr != "")
	{
		alert("The details you have entered the calculator are incomplete.\nPlease complete the following:\n\n"+alertStr)
	}
	else
	{
		//alert("Submitting")
		document.calc2.submit()
	}
}
 function InvalidChar(str1)
    {
      var arr_str2 = new Array("http://","script","--;","delete","viagra");
      //arr_str2 = ();
      var s = -1; 
      for (i=0;i<4;i++)
      {        
        s = str1.indexOf(arr_str2[i]);
        if (s > -1)
        {
            break;
        }
      }
      return(s);
    }
