//if (!document.getElementById) {
//    window.location = 
//	   "http://www.webstandards.org/upgrade/"
//}


function SetAsHomePage(othis, url)
{
	var ms = navigator.appVersion.indexOf("MSIE")
	var ie5 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+7)) >= 5)
	if(ie5)
	{
		othis.style.behavior='url(#default#homepage)';
		othis.setHomePage(url);
	}
	else
	{
		alert("Go to your web browser preferences and change your Home Page to '"+url+"'.");
	}
}

function AddAsBookmark(url, title)
{
	bookmarkurl = url
	bookmarktitle= title
	if (document.all)
	window.external.AddFavorite(bookmarkurl, bookmarktitle)
}

function ShowProgress(Path, PID)
{
	strAppVersion = navigator.appVersion;
	var win;
	if (Path == ""){
		alert ("You must select the file you wish to upload from your computer by clicking on the 'Browse' button.");
		return false;
	}
		
	if (Path == "upload"){
		win = window.open('', PID, 'width=400,height=140,left=100,top=100', true);
	}else{
		win = window.open('', PID, 'width=370,height=115,left=100,top=100', true);
		window.focus();
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
		{
			winstyle = "dialogWidth=375px; dialogHeight:130px; dialogLeft:100px; dialogTop:100px;";
			window.showModelessDialog('File/ProgressUpload/FrameBar0842.html?to=10&amp;PID='+PID+'&b=IE',null,winstyle);
		}
		else
		{
			window.open('File/ProgressUpload/FrameBar0842.html?to=10&amp;PID='+PID+'&b=NN','','width=370,height=115,left=100,top=100', true);
		}
	}
	return true;
}

function ShowDeleteFileWindow(WindowName)
{
	var win;
	win = window.open('', WindowName, 'width=370,height=115,left=100,top=100', true);
	window.focus();
	return true;
}

function getSelect(theField) {
	return theField.options[theField.options.selectedIndex].text;
}

function setSelect(theField, strValue) {
	for (i = 0; i < theField.options.length; i++) {
		//alert(theField.options[i].value + " - " + strValue);
		if (theField.options[i].value == strValue) {
			theField.options.selectedIndex = i;
			return;
		}
	}
}

function WHTML(HTML){
	document.write(HTML);
}

function WriteHREFLink(Target, Link, DisplayText){
	WHTML("<a target='"+Target+"' href='"+Link+"'>"+DisplayText+"</a>");
}

function WriteEncodedEmailHREFMailto(Email, DisplayText){
	WriteHREFLink('', GetEncodedEmailMailto(Email), DisplayText);
}

function GetEncodedEmailMailto(Email){
	return "m"+"a"+"i"+"l"+"t"+"o"+":"+Email;
}

function DeObfuscateText(encoded){
	var decoded, cipher, shift, ltr, t
 	cipher = "3ZbYXdWeV4fUgThSiRcjQ9kPlOmNnMoLpK@q0JrIsH1tGuFvEwDxCyBzA25a678";
	shift=encoded.length;
	decoded="";

	//alert(encoded);
	for (i=0; i<encoded.length; i++){
		if (cipher.indexOf(encoded.charAt(i))==-1){
			ltr=encoded.charAt(i);
			decoded+=(ltr);
		}
		else {     
			ltr = (cipher.indexOf(encoded.charAt(i))-shift+cipher.length) % cipher.length;
			if (ltr < 0){
				ltr = cipher.length + ltr;
			}
			decoded+=(cipher.charAt(ltr));
		}				
	}
	//alert(decoded);
	return decoded;
}
