
//////// ----- GLOBAL VARIABLE ----- /////////

var gStrAppend = 'inCtx3';
var gStrAlert = 'Please enter a keyword to search.';


//////// ----- GLOBAL VARIABLE ----- /////////


function siteSearch() {
	var term = document.getElementById("term").value ;
	if (term == '') { 
		alert(gStrAlert);
		return false ; 
	}else{
		var search_href = '/content/search.htm?' + gStrAppend + 'txtKeyword=' + term + '&' + gStrAppend + 'cmdKeywordSearch=search&' + gStrAppend + 'txtMode=site';
		//alert(search_href);
		window.location.href = search_href ;
	}
	window.event.cancelBubble = true;
	window.event.returnValue = false;
}


function onKeyPress(e) {

	NS4 = (document.layers)? true:false
	IE4 = (document.all)? true:false
	docom = (document.getElementById) ? true:false

	var keycode;
	var strName = navigator.appName;

	if (NS4) keycode = e.which 
	else if (IE4) keycode = window.event.keyCode
	else if (docom)	keycode = e.keyCode

	if (keycode == 13) {
		if((IE4)&&(navigator.platform=='MacPPC')){
			document.frm.HiddenClick.value = '';
			//strName = strName + ' : ' + navigator.platform
			alert(strName)
		}else{
			siteSearch()
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
	}
}





////////////////////////////////////////////////
////////// ----- REGULAR SEARCH ----- //////////
//--------------------------------------------//

function siteSearchMain() {
	var term = document.getElementById(gStrAppend + "txtKeyword").value ;
	var qu = '' ;
	if (term == '') { 
		alert(gStrAlert);
		event.returnValue=false;
		return false ; 
	}else{
		cmsForm.action = '/content/search.htm';
		cmsForm.submit();
		event.returnValue=false;
	}
}

function onKeyPressMain(e, oCtrl) {

	NS4 = (document.layers)? true:false
	IE4 = (document.all)? true:false
	docom = (document.getElementById) ? true:false

	var keycode;
	var strName = navigator.appName;

	if (NS4) keycode = e.which 
	else if (IE4) keycode = window.event.keyCode
	else if (docom)	keycode = e.keyCode

	if (keycode == 13) {
		if((IE4)&&(navigator.platform=='MacPPC')){
			document.frm.HiddenClick.value = '';
			//strName = strName + ' : ' + navigator.platform
			alert(strName)
		}else{
			siteSearchMain()
		}
	}
}

//--------------------------------------------//
////////// ----- REGULAR SEARCH ----- //////////
////////////////////////////////////////////////





////////////////////////////////////////////////
////////// ----- ADVANCE SEARCH ----- //////////
//--------------------------------------------//

function setDates(fdate, edate) {
	var start_dt = document.getElementById(gStrAppend + 'txtStartDate') ;
	var end_dt = document.getElementById(gStrAppend + 'txtEndDate');
	start_dt.value = fdate ;
	end_dt.value = edate ;
}
	
function calcDate(rng) {
	var x = new Date()
	var y = new Date()
	x.setDate(x.getDate() - 1)

	var oRange = document.getElementById('range');
	if (rng == '7') {
		y.setDate(x.getDate() - 7)
	} else if (rng == '30') {
		y.setMonth(x.getMonth() - 1)
	} else if (rng == '90') {
		y.setMonth(x.getMonth() - 3)
	} else if (rng == '365') {
		y.setYear(x.getFullYear() - 1)
	}
	if (rng == 'B' || rng == 'D') {
		setDates('','') ;
	} else {
		fdate = parseInt(y.getMonth()+1) + '/' + y.getDate() + '/' + y.getFullYear()
		edate = parseInt(x.getMonth()+1) + '/' + x.getDate() + '/' + x.getFullYear()
		setDates(fdate, edate)
	}
}

//--------------------------------------------//
////////// ----- ADVANCE SEARCH ----- //////////
////////////////////////////////////////////////



////////////////////////////////////////////////
////////// ----- inCalendar ----- //////////////
//--------------------------------------------//
function SetDropdownName(strThis){
	var strT;
	return true;
	if (strThis != null){
		strT = strThis.name;
		strT = strT.substring(0, strT.length-4);
		document.getElementById('hidDropPrefix').value = strT;
	}
}
//--------------------------------------------//
////////// ----- inCalendar ----- //////////////
////////////////////////////////////////////////



function CreateBookmarkLink() 
{

	title = document.title; 

	// Blogger - Replace with <$BlogItemTitle$> 
	// MovableType - Replace with <$MTEntryTitle$>

	url = window.location.href;
	// Blogger - Replace with <$BlogItemPermalinkURL$> 
	// MovableType - Replace with <$MTEntryPermalink$>
	// WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) 
	{ 
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { 
		// IE Favorite
		window.external.AddFavorite( url, title); 
	}else if(window.opera && window.print && window.sidebar) {
		// Opera Hotlist
		window.sidebar.addPanel(title, url,"");
	} else {
		alert("Press Ctrl+D(Command+D on Mac) to bookmark this page.")
	}
}

function getQueryParam(strParam)
{
	var strURL = window.location.toString();
	var strQuery = '';
	var strSearchTerm = '';

	if (strURL.indexOf('?') > 0)
	{
		//grab all of the querysting info
		var strQuery = strURL.substring(strURL.indexOf('?'));

		if (strQuery.indexOf(strParam + '=') > 0)
		{

			//Kill anything before the term we need
			strQuery = strQuery.substring(strQuery.indexOf(strParam + '='))
			strQuery = strQuery.substring(strQuery.indexOf('=') + 1)

			//Kill anything after our search term
			if (strQuery.indexOf('&') > 0){strQuery = strQuery.substring(0, strQuery.indexOf('&'));}

			//Replace any URL spaces (%20)
			while (strQuery.indexOf('%20') > 0 )
			{
				strQuery = strQuery.replace('%20', ' ');
			}

			strSearchTerm = strQuery
		}
	}

	return strSearchTerm;
}



////////////////////////////////////////////////
////////// ----- Copyright  ----- //////////////
//--------------------------------------------//
function Copyright()

{

if (document.getElementById('isLive'))
    {

var now = new Date();
var Year = now.getFullYear();

document.write ('&copy; ' + Year);

	}

}
//--------------------------------------------//
////////// ----- Copyright  ----- //////////////
////////////////////////////////////////////////

