//BLONDIE!!!

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//amustafic: Tango: TODO Start ****************************************
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
			var keyCode = (isNN) ? e.which : e.keyCode; 
			var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
			if(input.value.length >= len && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
		function containsElement(arr, ele) {
			var found = false, index = 0;
			while(!found && index < arr.length)
			if(arr[index] == ele)
			found = true;
			else
			index++;
			return found;
		}
		function getIndex(input) {
			var index = -1, i = 0, found = false;
			while (i < input.form.length && index == -1)
			if (input.form[i] == input)index = i;
			else i++;
			return index;
		}
		return true;
	}//end autoTab
	
	
	function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


function portWin(url, left, top, x, y) {
	var pWin = null;
	pWin = window.open (url, 'newWin', 'left=' + left + ',top=' + top + ',width=' + x + ',height=' + y + ',titlebar=no,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no');
	if (window.pWin) pWin.focus();
}

function portWin2(url, left, top, x, y) {
	var pWin = null;
	pWin = window.open (url, 'newWin', 'left=' + left + ',top=' + top + ',width=' + x + ',height=' + y + ',resizable=1,scrollbars=1,status=1,menubar=no');
	if (window.pWin) pWin.focus();
}

function portWinWithMenuBar(url, left, top, x, y) {
	var pWin = null;
	pWin = window.open (url, 'newWin', 'left=' + left + ',top=' + top + ',width=' + x + ',height=' + y + ',resizable=1,scrollbars=1,status=1,menubar=yes');
	if (window.pWin) pWin.focus();
}

//Used for Report Navigation control	
//used for the main menu navigation
var tempImg = 0;
function changeImg(imgName){
	if (tempImg == 0){
		imgOn(imgName);	
	} else {
		imgOff();		
	}	
}

function imgOn(imgName) {
	document.images[imgName].src = eval(imgName + "on.src");
	tempImg = imgName;			
}

function imgOff() {
	if (tempImg != 0){
		document.images[tempImg].src = eval(tempImg + "off.src");
		tempImg = 0; 
	}  
}  

function popUpWin(url,winName,winValues){
	var popWin = window.open(url,winName,winValues);
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=400,left = 490,top = 362');");
}

//amustafic: Rebrand Phase 2
var MenuArray = new Array(0,0,0,0);		
function MyMouseOut(MenuOption, myimage, imageover, imageout, imageclick)
{
	if (MenuArray[MenuOption] == 1)
	{
		myimage.src = imageclick;
	}
	else {
		myimage.src = imageout;
	}
}

function MyMouseOver(myimage, imageover, imageout, imageclick)
{
	myimage.src = imageover;
}

function MyClick(MenuOption, myimage0, myimage1, myimage2, myimage3, myimage4, myimage5, myimage6, myimage7, imageover, imageout, imageclick)
{		
	for (var i=0; i< MenuArray.length; i++)
	{
		MenuArray[i] = 0;
	}
	
	//Reset all images other than the one clicked
	if (MenuOption == 0) {
		myimage0.src = imageclick;
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 1) {
		myimage1.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 2) {
		myimage2.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 3) {
		myimage3.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 4) {
		myimage4.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 5) {
		myimage5.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage6.src = 'images/menu_opt6.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 6) {
		myimage6.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage7.src = 'images/menu_opt7.gif';
	}
	else if (MenuOption == 7) {
		myimage7.src = imageclick;
		myimage0.src = 'images/menu_opt0.gif';
		myimage1.src = 'images/menu_opt1.gif';
		myimage2.src = 'images/menu_opt2.gif';
		myimage3.src = 'images/menu_opt3.gif';
		myimage4.src = 'images/menu_opt4.gif';
		myimage5.src = 'images/menu_opt5.gif';
		myimage6.src = 'images/menu_opt6.gif';
	}
	
	MenuArray[MenuOption] = 1;
}

function MyClickMarketplace(MenuOption, myimage0, myimage1, myimage2, myimage3, myimage4,
							imageclick, imageURL0, imageURL1, imageURL2, imageURL3, imageURL4)
{		
	for (var i=0; i< MenuArray.length; i++)
	{
		MenuArray[i] = 0;
	}
	
	//Reset all images other than the one clicked
	if (MenuOption == 0) {
		myimage0.src = imageclick;
		myimage1.src = imageURL1;
		myimage2.src = imageURL2;
		myimage3.src = imageURL3;
		myimage4.src = imageURL4;
	}
	else if (MenuOption == 1) {
		myimage1.src = imageclick;
		myimage0.src = imageURL0;
		myimage2.src = imageURL2;
		myimage3.src = imageURL3;
		myimage4.src = imageURL4;
	}
	else if (MenuOption == 2) {
		myimage2.src = imageclick;
		myimage0.src = imageURL0;
		myimage1.src = imageURL1;
		myimage3.src = imageURL3;
		myimage4.src = imageURL4;
	}
	else if (MenuOption == 3) {
		myimage3.src = imageclick;
		myimage0.src = imageURL0;
		myimage1.src = imageURL1;
		myimage2.src = imageURL2;
		myimage4.src = imageURL4;
	}
	else if (MenuOption == 4) {
		myimage4.src = imageclick;
		myimage0.src = imageURL0;
		myimage1.src = imageURL1;
		myimage2.src = imageURL2;
		myimage3.src = imageURL3;
	}
	
	MenuArray[MenuOption] = 0;
} // MyClickMarketplace

//amustafic: Aperture pixel tracking
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Aperture Start
// Following aperture code was added on 09/01/2006.
// The version was NOT updated from the previous
// version but the code is definitely different.
//-------------------------------------------------
// rwtag.js
// Version 0.9.6 2006-03-01

var rwSetup = new rwSetup();
var rwImage = new Image;

// Routine to pick up exisiting PPC parameters. Adapt and uncomment code as necessary.
// Regular expression matches http://www.mysite.com/landingpage/?sc=PPCENGINECODE
var rwTagPrefix
var rwGrep

rwGrep = new RegExp("sc=(404900)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(405000)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(405100)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(409904)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(409903)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(409902)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(410003)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(410004)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(410005)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm="+matches[1]+",PPC,";
}

rwGrep = new RegExp("sc=(410006)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm=Google,PPC,";
}

rwGrep = new RegExp("sc=(410007)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm=miva,PPC,";
}

rwGrep = new RegExp("sc=(410008)");
if (rwGrep.test(location.href)) {
	matches = location.href.match(rwGrep);
	rwTagPrefix="rw.cm=overture,PPC,";
}




function rwSetup() {
	this.rwVersion = "0.9.6";
	this.rwProfile = "creditexpert";
	this.rwTagServerGIF = "www.sptag2.com/rwtag.gif";
	this.rwCheckMetaTags = true;
	this.rwSendTitle = false;
	this.rwSendURL = true;
	this.rwSequence = false;
	this.rwCookieName = "rwtag";	
	this.rwCookieCreate = true;
	this.rwCookieDays = 3650;
	this.rwCookieDomain = null;
	this.rwCookieEnabledCheck = true;
	this.rwDebug = false;
}

function rwAddTag( rwPage, rwPrefix, rwPageTitle ) {
	if (typeof rwPage =="string" && rwPage.length>0){
		var rwString = "http"+(window.location.protocol.indexOf('https:')==0?'s':'') + "://" + rwSetup.rwTagServerGIF;
		rwString = rwString + "?" + (typeof rwPrefix =="string" && rwPrefix.length>0 ? rwPrefix + "&" : "")  + rwParameters();
		rwString = rwString + "&rw.ul=" + escape(location.href.substring(0, location.href.lastIndexOf("/")+1) + rwPage) + "&rw.rf=" + escape(location.href);
		if (typeof rwPageTitle =="string" && rwPageTitle.length>0 && rwSetup.rwSendTitle){
			rwString = rwString + "&rw.ti=" + escape(rwPageTitle);
		}
		return rwTagServer(rwString);
	}
	return null;
}

function rwCookieTag(){
	var rwCookieName = rwSetup.rwCookieName
	var rwCookiePath = "/";
	var rwCookieDomain = rwSetup.rwCookieDomain;
	var rwCookieDays = rwSetup.rwCookieDays;
	var rwCookieString = "";
	if (rwCookieName.length == 0){
		return "";
	}
	rwCookieString = rwGetCookieLastValue( rwCookieName );
	if (typeof rwCookieString =="string" && rwCookieString.length>0){
		return "rw.ck=" + rwCookieString; 
	}
	if (rwSetup.rwCookieCreate == false){
		return "rw.ck=";
	} else {
		var rwNowString = new Date().getTime();
		var rwCookieString = "rwtag." + location.href.length + "." + navigator.userAgent.length + "." + rwNowString;
		var rwCookieExpiry = null;
		if (rwCookieDays>0) {
			rwCookieExpiry = new Date();
			rwCookieExpiry.setDate(rwCookieExpiry.getDate() + parseInt(rwCookieDays))
			rwCookieExpiry = rwCookieExpiry.toGMTString();
		}
		rwSetCookie( rwCookieName, rwCookieString, rwCookieExpiry, rwCookiePath, rwCookieDomain, null);
		rwCookieString = "";
		rwCookieString = rwGetCookieLastValue(rwCookieName);
		if (typeof rwCookieString =="string"){
			return "rw.ck=" + rwCookieString + "&rw.ckcreated=" +  rwNowString;
		} else {
			return "rw.ck=";
		}
	}
	return "";
}
	
function rwMetaTags(){		
	var rwMT = "";
	var rwMTags;
	if (document.all){
		rwMTags = document.all.tags("meta");
	} else if (document.documentElement){
		rwMTags = document.getElementsByTagName("meta");
	}
	if (typeof rwMTags !="undefined"){
		for (var i=1;i<=rwMTags.length;i++){
			var rwMTag=rwMTags.item(i-1);
			if (rwMTag.name){
				if (rwMTag.name.indexOf('rw.')==0){
					rwMT=rwMT+"&"+rwMTag.name+"="+escape(rwMTag.content);
				}
			}
		}
	}
	return rwMT;
}
	
function rwParameters(){
	var rwNow = new Date();
	var rwString = "rw.pf=" + rwSetup.rwProfile + "&rw.nw="+ rwNow.getTime();	
	if (rwSetup.rwCookieName.length>0){
		rwString = rwString + "&" + rwCookieTag();
	}			
	if (rwSetup.rwCookieEnabledCheck == true && rwIsCookieEnabled()==false) {
		rwString = rwString + "&rw.ckstatus=disabled";
	}	
	if (rwSetup.rwSequence == true ){
		var rwSequence = rwGetCookieLastValue("rwsequence");
		if (typeof rwSequence=="string" && rwSequence.length>0){
			rwSequence = "" + (parseInt(rwSequence)+1);
			rwTagHTML = rwString + "&rw.sq=" + rwSequence;
			rwSetCookie("rwsequence",rwSequence,null,"/",rwSetup.rwCookieDomain,null);		
		} else {
			rwSequence = "1";
			rwSetCookie("rwsequence",rwSequence,null,"/",rwSetup.rwCookieDomain,null);		
			rwTagHTML = rwString + "&rw.sq=" + rwSequence;
		}
	}
	return rwString;	
}

function rwTag( rwPrefix ){			
	return rwTagServer( rwURL( rwPrefix ));
}
	
function rwTagServer( rwURLString ){	
	var rwTagHTML = rwURLString;
	
	if (rwTagHTML.length>2048&&navigator.userAgent.indexOf('MSIE')>=0){
		rwTagHTML=rwTagHTML.substring(0,2040)+"&rw.End=1";
	}
	if (document.images){
		rwImage.src = rwTagHTML;
	} else {
		rwTagHTML = '<I' + 'MG BORDER=\"0\" NAME=\"rwtag\" WIDTH=\"1\" HEIGHT=\"1\" SRC=\"' + rwTagHTML + ' \" >' ;
		document.write( rwTagHTML );
	}
	if (rwSetup.rwDebug == true) {
		document.write("<br/><b>"+rwTagHTML+"</b>");
	}
	return rwTagHTML;
}	

function rwURL( rwPrefix ){
	var rwURLString = "";
	if (typeof rwTagPrefix== "string" && rwTagPrefix.length>0) {
		rwURLString = rwTagPrefix;
	}
	if (typeof rwPrefix == "string" && rwPrefix.length>0){
		rwURLString = (rwURLString.length>0 ? rwURLString + "&" : "") + rwPrefix;
	} 
	rwURLString = "?" + (rwURLString.length>0 ? rwURLString + "&" : "") + rwParameters();
	rwURLString = "http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://" + rwSetup.rwTagServerGIF + rwURLString;		
	if (rwSetup.rwSendURL == true){
		rwURLString = rwURLString + "&rw.ul=" + escape(location.href);	
	}
	rwURLString = rwURLString + "&rw.rf=" + escape(window.document.referrer);
	if (rwSetup.rwCheckMetaTags == true){
		rwURLString = rwURLString + rwMetaTags();
	}	
	if (rwSetup.rwSendTitle == true) {
		rwURLString = rwURLString + "&rw.ti=" + escape(document.title);
	}
	return rwURLString;
}
	
function rwIsCookieEnabled() {
	var rwEnabled = (typeof document.cookie == "string" && document.cookie.length>0 ? true : false);
	if ( rwEnabled == false && typeof document.cookie == "string"){
		document.cookie = "rwCheckCookie=testing";
		if (document.cookie == "rwCheckCookie=testing"){
			rwEnabled = true;
		}
	}
	return rwEnabled;	
}
	
function rwGetCookieLastValue( rwCookieName ) {
	if (typeof rwCookieName=="string" && rwCookieName.length>0){
		var rwString = "; " + rwCookieName + "=";
		var rwCookie = "; " + document.cookie;
		var rwStartPos = rwCookie.lastIndexOf( rwString );
		if (rwStartPos>-1){
			rwStartPos = rwStartPos + rwString.length;
			var rwEndPos = rwCookie.indexOf( ";", rwStartPos );
			rwString = rwCookie.substring( rwStartPos, (rwEndPos<0 ? rwCookie.length : rwEndPos ));
			return unescape(rwString);
		}
	}
	return "";
}

function rwSetCookie(name, value, expires, path, domain, secure) {
		document.cookie = name + "=" + escape (value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ Aperture End

//amustafic: Tango: End ***********************************************

 function CreateBookmarkLink(title)
 {
	// We want a url like this
	// "http://www.creditexpert.co.uk/MCClogin.aspx";
	// So we build it up without the query string:
	url = location.protocol + '//' + location.hostname + location.pathname;

  	if (window.external)
  	{
  		LogMessageToServer('MCClogin.aspx', 'Add Bookmark', 'Bookmark Link Used');
	  	window.external.AddFavorite(url, title);
	  	// code reference: http://www.java2s.com/Code/JavaScriptReference/Javascript-Methods/AddFavorite.htm
	}
 }
 
 // Send a POST to the web server specified by target
 // with the given action and message
 function LogMessageToServer(target, action, message)
 {
	try
	{
		//http://geekswithblogs.net/rashid/archive/2007/07/21/Asp.net-Ajax-and-VS2003.aspx
		var request = new Sys.Net.WebRequest();
		request.set_url(target);
		request.set_httpVerb('POST');
		request.set_body('Action=' + action + '&Message=' + message);
		request.invoke();
	} catch (e) {}
 }
 
// Clears all text inputs and sets all drop down lists
// to the first element for controls contained in id
// useage: ResetChildElements('MyContainer');
function ResetChildElements(id)
{
	var element = document.getElementById(id);
	if (!element)
		element = id; // in case id is already an object
		
	if (element)
	{
		var inputs = element.getElementsByTagName('*');
		
		for(i = 0; i < inputs.length; i++)
		{
			ResetInput(inputs[i]);
		}
	}
}
// Clears an input text or sets a drop down list to the first element
function ResetInput(id)
{
	try
	{
		var element = document.getElementById(id);
		if (!element)
			element = id; // in case id is already an object
			
		if (element)
		{
			if (element.type == "text") // text box
				element.value = "";
			else if (element.selectedIndex) // list box 
				element.selectedIndex = 0;
		}	
	}catch (exc) {}					
}

// Set background color to all non text elements contained in 'id'
function SetBackgroundColor(id, color)
{
	var element = document.getElementById(id);
	if (!element)
		element = id; // in case id is already an object
		
	if (element)
	{
		var inputs = element.getElementsByTagName('*');
		
		for(i = 0; i < inputs.length; i++)
		{
			if (inputs[i].type != "text")
			{
				inputs[i].style.backgroundColor = color;
			}
		}
	}
}

function SetControlVisibility(id, visible)
{
	var element = document.getElementById(id);
	if (!element)
		element = id; // in case id is already an object
	
	if (visible)
	{
		element.style.display = "block";
	}
	else
	{
		element.style.display = "none";
	}		
}

function toggleDiv(obj)
{
	var el = document.getElementById(obj);
	if(el.style.display != "block")
	{
		el.style.display = "block";
	}
	else
	{
		el.style.display = "none";
	}
}

function EnableChildElements(id, enabled)
{		
	var element = document.getElementById(id);
	if (!element)
		element = id; // in case id is already an object
		
	if (element)
	{
		var inputs = element.getElementsByTagName('*');
		for(i = 0; i < inputs.length; i++)
		{
			EnableInput(inputs[i], enabled);
		}
	}
}
// Clears an input text or sets a drop down list to the first element
function EnableInput(id, enabled)
{
	try
	{
		var element = document.getElementById(id);
		if (!element)
			element = id; // in case id is already an object
		if (element)// && dom_getAttribute(element, "enabled") != null)
		{
			element.enabled = enabled;
		}	
	}catch (exc) {alert(exc.message);}					
}
// Takes a client id of a page element
// Sets the innerHTML of that to the data|variable passed
function LoadPageElement(elementID, data)
{
	//alert('Replace ' + elementID + ' with ' + data);
	var element = document.getElementById(elementID);
	if (element != null)
	{
		element.innerHTML = data;
	}
}
/*
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
			var keyCode = (isNN) ? e.which : e.keyCode; 
			var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
			if(input.value.length >= len && !containsElement(filter,keyCode)) {
			input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
		function containsElement(arr, ele) {
			var found = false, index = 0;
			while(!found && index < arr.length)
			if(arr[index] == ele)
			found = true;
			else
			index++;
			return found;
		}
		function getIndex(input) {
			var index = -1, i = 0, found = false;
			while (i < input.form.length && index == -1)
			if (input.form[i] == input)index = i;
			else i++;
			return index;
		}
		return true;
	}//end autoTab
	
	
	function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

//Function for Report View
function popUp(url,win,features) {
	if (features == null){
		features = 'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1';
	}
      Win=window.open(url,win,features);
    }
    
//Universal window.open function
function openWindow(URL,name,props) {
	window.open(URL,name,props);
}

var exitvariable = true;
//Checks to see if parent window
//If parent window then load page in parent and close child
//If no parent load page in child
function setNewWindow(URL){
 newWindow=window.opener;
 if (newWindow == null || newWindow.closed){
   newWindow = popUp(URL,'Order','width=787,height=533,address=1,location=1,menubar=1,scrollbars=1,status=1,resizable=1,toolbar=1');
   self.close();
   // return false; 
 } 
 else {  
 newWindow.location=URL;
 //first check for valid variable in opening window
 if (newWindow.exitvariable != null){
	newWindow.exitvariable=false;
 }
 self.close();
 }
}
//Checks to see if parent window
//If parent window then load page in parent and close child
//If no parent load page in child
function toMainWindow(URL){
 mainWindow=window.opener;
 if (mainWindow == null || mainWindow.closed){
   mainWindow = self;   
   mainWindow.location=URL;
   return false; 
 } 
 else {
  if (mainWindow.exitvariable != null)
  {
	mainWindow.exitvariable=false;
  }
  mainWindow.location=URL;
  self.close();
 }
}

function myUnloadHandler(url,name,props)
{
	if (exitvariable)
	{
		var exitPopup = popUp(url,name,props);
	}
}

function MoreInfo(sHtml, pWidth, pHeight){
	var sbHtml = sHtml;
	var elements = "width=" + pWidth + ",height=" + pHeight + ",resizable=1";
	var winName = window.open('','popup',elements);

	winName.document.write(sbHtml);
}

function eReference(eName) {
	if (document.layers) {
	//we want 1 object (not nested)
		//simple layer reference
		if (eReference.arguments.length == 1) {
			var cEl = eval("document.layers['" + eName + "']");		
		}	
	//old IE browsers:
	} else if (document.all) {
		var cEl = eval('document.all.' + eName);	
	//W3C standard:
	} else {
		var cEl = document.getElementById(eName);
	}
	return cEl;
} 

function displayObj(id, display){
   if (document.getElementById || document.all){
   		if (display){
			if(eReference(id).style.display == 'none' || eReference(id).style.display == ''){
				eReference(id).style.display = 'block';
			}
		}else if (!display){
			if(eReference(id).style.display == 'block' || eReference(id).style.display != ''){
				eReference(id).style.display = 'none';
			}
		}	
	}
}

function toggleDisplay(id, state){
	//alert("fromToggleDisplay" + " " + id + "  " + state);
	if (state){
		displayObj(id, true);
	}else{
		displayObj(id, false);
	}
}

function submitform() {  
  if (submitform.arguments.length > 0) {
	  var formname = eval("document."+submitform.arguments[0]);
	  formname.submit();
  }
}

function submitASPXForm(url, target)
{	
	document.forms[0].action		= url;
	document.forms[0].target		= target;
	document.forms[0].submit()
}

*/
