var ie, ns;

ie = document.all;
ns = document.getElementById && !document.all;

var gPageIndex = 0;
var gbTodayEvent = false;

function gotoPage(strLink)
{
	document.location.href = strLink;
}


function ClearOptions(OptionList) {
   // Always clear an option list from the last entry to the first
   for (x = OptionList.length; x >= 0; x = x - 1) {
      OptionList[x] = null;
   }
}

function AddToOptionList(OptionList, OptionValue, OptionText) {
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

function launchUrl ( strUrl )
{
	window.open ( strUrl, "_samsurl" );
}

function displayFontHelp( strUrl )
{
	var sFeature = "width=523,height=315,scrollbars=auto,resizable=1";
	sFeature += ",left=" + (window.screenLeft+150) + ",top=" + (window.screenTop-25);
	
	var nwin = window.open(strUrl,"_samsfont",sFeature);
	nwin.focus()
}

function displayFont( strLang )
{
	var strUrl = "/common/help/"+strLang+"/font.asp"
	var sFeature = "width=523,height=350,scrollbars=auto,resizable=1";
	sFeature += ",left=" + (window.screenLeft+150) + ",top=" + (window.screenTop-25);
	
	var nwin = window.open(strUrl,"_samsfont",sFeature);
	nwin.focus()
}

function emailLink( strTitle, strLink )
{
	var strUrl = "/common/mail/emaillink.asp?title=" + strTitle + "&link=" + strLink;
	var sFeature = "width=300,height=235,scrollbars=auto,resizable=1";
	sFeature += ",left=" + (window.screenLeft+150) + ",top=" + (window.screenTop-25);
	
	var nwin = window.open(strUrl,"_samsemail",sFeature);
	//nwin.focus()
}

function emailNewsLetterLink( strTitle, strSubTitle, strLink )
{
	var strUrl = "/common/mail/emailnewsletter.asp?subtitle=" + strSubTitle + "&title=" + strTitle + "&link=" + strLink;
	var sFeature = "width=300,height=450,scrollbars=auto,resizable=1";
	sFeature += ",left=" + (window.screenLeft+150) + ",top=" + (window.screenTop-25);
	
	var nwin = window.open(strUrl,"_samsemail",sFeature);
	//nwin.focus()
}

function displayHospDirHelp( strUrl )
{
	var sFeature = "scrollbars=0,resizable=1";
	sFeature += ",left=" + (window.screenLeft+15) + ",top=" + (window.screenTop-15);
	
	var nwin = window.open(strUrl,"_samshosp","");
	nwin.focus()
}

 function getElement(id) 
 { 
 	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
} 

function RemoveSpaces(str)
{
	var strTemp=new String(str);
	//Use regular expressions to remove white-spaces in string
	return(strTemp.replace(/\s*/g,""));
}

		
function CheckEmail(strEmail)
{
	var intEmailTest1,intEmailTest2,blnIsEmailValid;
	var newString;

	//Check email for spaces and remove them
	//Use regular expressions to remove the spaces
	strEmail=RemoveSpaces(strEmail);
	//Validate email address
	//newString = strEmail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.biz)|(\..{2,2}))$)\b/gi);
	newString = strEmail.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i);
	if (!newString)
		return(false);
	else 
		return(true);
}

function subscribeNewsletter()
{
	window.location.href = "/periodicals/enewsletter/subscription.asp"
}

function GetSignificance()
{
	parent.document.getElementById("sodid").innerHTML = getElement("idSigOfDay").innerHTML
}
