var agt		= navigator.userAgent.toLowerCase();
var versInt	= parseInt(navigator.appVersion);
var is_aol	= (agt.indexOf("aol") != -1);
var wrnDomainArray = location.hostname.split( '.' );
var EditionDomain = ( wrnDomainArray.length > 1 ) ? '.' + wrnDomainArray[wrnDomainArray.length-2] + '.' + wrnDomainArray[wrnDomainArray.length-1] : '';

function WRN_menuBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#69c';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#036';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
				}
		}
	}
}

function WRN_menuBarClick( tableCellRef, navStyle, url ) {
	WRN_menuBar( tableCellRef, 0, navStyle );
	WRN_goTo( url );
}


// this function is used to redirect the search form if necessary
function validate( theFormValidate ) { 
	return WRN_validateSearchForm( theFormValidate ); 
}

function WRN_validateSearchForm( theForm )
{
  return true;						//	dummy
}

function WRN_goTo( url ) {
	window.location.href = url;
}


function WRN_roofBar( tableCellRef, hoverFlag ) {
	if ( hoverFlag ) {
		tableCellRef.style.backgroundImage = 'url("http://i.wrn.net/wrn/.element/img/1.0/main/roofbar_bg2.gif")';
		if ( document.getElementsByTagName ) {
			tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
		}
	} else {
		tableCellRef.style.backgroundImage = 'url("http://i.wrn.net/wrn/.element/img/1.0/main/roofbar_bg.gif")';
		if ( document.getElementsByTagName ) {
			tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#333';
		}
	}
}

function WRN_roofBarClick( tableCellRef, url ) {
	WRN_roofBar( tableCellRef, 0 );
	WRN_goTo( url );
}

function WRN_navBar( tableCellRef, hoverFlag, navStyle ) {
	if ( hoverFlag ) {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#69c';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#c00';
				}
		}
	} else {
		switch ( navStyle ) {
			case 1:
				tableCellRef.style.backgroundColor = '#036';
				break;
			default:
				if ( document.getElementsByTagName ) {
					tableCellRef.getElementsByTagName( 'a' )[0].style.color = '#000';
				}
		}
	}
}

function WRN_navBarClick( tableCellRef, navStyle, url ) {
	WRN_navBar( tableCellRef, 0, navStyle );
	WRN_goTo( url );
}


// this function is used to redirect the search form if necessary
function validate( theFormValidate ) { return WRN_validateSearchForm( theFormValidate ); }
function WRN_validateSearchForm( theForm )
{
	var site = 'wrn';
	var queryString = '';
	
	if ( theForm.sites )
	{
		if ( theForm.sites.options ) {		//	"sites" should be a select
			site = theForm.sites.options[theForm.sites.selectedIndex].value;
		} else {
			if ( theForm.sites.length )
			{
				for ( i = 0; i < theForm.sites.length; i++ )
				{
					if ( theForm.sites[i].checked ) {
						site = theForm.sites[i].value;
					}
				}
			}
			else
			{
				site = theForm.sites.value;
			}
		}
	}
	
	if ( theForm.qt ) {
		queryString = theForm.qt.value;
	} else {
		if ( theForm.QueryText ) {
			queryString = theForm.QueryText.value;
		} else {
			if ( theForm.query ) {
				queryString = theForm.query.value;
			}
		}
	}
	
	if ( !queryString ) {
		return false;
	}
	
	switch ( site.toLowerCase() ) {
		case "web":
		case "google":
			theForm.action = ( location.hostname.indexOf( 'edition' ) != -1 ) ? "http://websearch.edition.wrn.com/search/search" : "http://websearch.wrn.com/search/search";
			theForm.query.value = queryString;
			return true;
		
		case "internet":
		case "wrnasiaweb":
		case "wrneuropeweb":
			theForm.action = "http://search.netscape.com/nscp_results.adp";
			theForm.query.value = queryString;
			return true;
		
		case "wrn":
			theForm.action = "http://search.wrn.com/wrn/search";
			theForm.query.value = queryString;
			return true;
			
		case "edition":
			theForm.action = "http://search.edition.wrn.com/pages/search/advanced.jsp";
			return true;	
		
		case "wrnasia":
			theForm.action = "http://search.wrn.com/asia/search";
			theForm.query.value = queryString;
			theForm.source.value = 'wrn';
			return true;
		
		case "wrneurope":
		case "wrneuropeir":
		case "wrneuropeit":
		case "wrneuropenl":
		case "wrneuropeswz":
		case "wrneuropeuk":
			theForm.action = "http://search.wrn.com/europe/search";
			theForm.query.value = queryString;
			theForm.source.value = 'wrn';
			return true;
		
		case "wrnsi":
			theForm.action = "http://search.si.wrn.com/si/search";
			theForm.query.value = queryString;
			theForm.source.value = 'si';
			return true;
		
		case "wrnfn":
		case "wrnmoney":
			theForm.action = "http://search.money.wrn.com/money/search";
			theForm.query.value = queryString;
			theForm.source.value = 'money';
			return true;
		
		case "time":
			theForm.action = "http://www.pathfinder.com/time/daily/searchresults/1,2645,,00.html";
			theForm.keyword.value = queryString;
			theForm.col.value = 'time';
			return true;
		
		case "wrnfyi":
			theForm.action = "http://websearch.wrn.com/search/snsearch";
			theForm.source.value = 'fyi';
			return true;
		
		case "wrnlaw":
		default:
			return true;						//	unsupported site?
	}
}


// used to open popup windows from the dateline
function WRN_openMap( location )
{
	WRN_openPopup( location, '620x430', "width=620,height=430,scrollbars=no,resizable=no" );
}


// this is for opening pop-up windows
function WRN_openPopup( url, name, widgets, openerUrl )
{
	var host = location.hostname;
	var popupWin = window.open( url, name, widgets );
	
	if ( popupWin && popupWin.opener ) {
		if ( openerUrl )
		{
			popupWin.opener.location = openerUrl;
			popupWin.focus();
		}
		popupWin.opener.top.name = "opener";
	}
}


function email()
{

}

function asiaEmail()
{

}

function euroEmail()
{

}

function italiaEmail()
{

}

function splitWindow(s) 
{

}

//this is for the dropdowns on the pages like TRAVEL


function napVector (vectorChoice) {

	   }
function ipVector (vectorChoice) {

	   }


function WRN_setOptionsFromArray( selectOptions, array ) {

}



