function winopen(form_elem) {
  nav_name = navigator.appName;
  if (nav_name != "Netscape") { 
    new_page = eval("document.selection." + form_elem + ".value"); 
  } else { 
    optionIndex = eval("document.selection." + form_elem + ".selectedIndex"
  ); 
  new_page = eval("document.selection." + form_elem + ".options[" + optionIndex + "].value"); }
  if (new_page != "0") { 
    window.location = new_page; 
    return true; 
  }
  return false; 
}

function popOpen(URL) {
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=350');");
}

function ShowDiv(id) {
	try{ 
		HideDiv(more);
		HideDiv(dictionary);
		HideDiv(translator);
		HideDiv(calendar);
	}
	catch(e) {}
    try {
		HideDiv(uscities);
		HideDiv(countries);
		HideDiv(worldcities);
		HideDiv(usstates);
		HideDiv(uscounties);
	}
	catch(e) { }
  id.style.display = '';
}

function HideDiv(id) {
  id.style.display = 'none';
}

function jump(targ, url) {
  eval(targ+".location='"+url.options[url.selectedIndex].value+"'");
}
function showAdvert(nr)
{
	if (document.layers)
		document.layers[nr].display = 'block';
	else if (document.all)
		document.all[nr].style.display = 'block';
	else if (document.getElementById)
		document.getElementById(nr).style.display = 'block';
	document.getElementById(nr+'_tab').className = 'item_top_selected';
}

function hideAdvert(nr)
{
	if (document.layers)	
		document.layers[nr].display = 'none';
	else if (document.all)
		document.all[nr].style.display = 'none';
	else if (document.getElementById)
		document.getElementById(nr).style.display = 'none';
	document.getElementById(nr+'_tab').className = 'item_top_not_selected';
}

function getBrowser()
{
	var agent = navigator.userAgent.toLowerCase();

	var isMoz = (agent.indexOf('mozilla') != -1);
	var isIE = (agent.indexOf('msie') != -1);
	var isSafari = (agent.indexOf('safari') != -1);
	var isOpera = (agent.indexOf('opera') != -1);
	
	document.write('<b>This browser\'s designation is:</b> ');
	document.write(navigator.userAgent + '<br />');
	
	if(isMoz || isIE || isSafari || isOpera)
	{
		if(isMoz) { return 'Mozilla'; }
		if(isIE) { return 'IE'; }
		if(isSafari) { return 'Safari'; }
		if(isOpera) { return 'Opera'; }
	}
	else { return 'Uknown'; }	
}

function NavigateSearch() 
{
	var kwds = document.getElementById('SearchBox').value;
	if (kwds == "") return;
	
	window.location = "http://www.wanamakerticket.com/ResultsGeneral.aspx?stype=0&kwds=" + escape(kwds); 
}
function KeyPressedSearch(e)
{
	if (e == null) e = window.event;
	if (e.keyCode == 13)
		NavigateSearch();
}

function citySearch(city,extra)
{
	window.location.href = 'http://enetez.com/search?cx=014489210867919910276%3A-q-mi5e1yya&cof=FORID%3A9&q='+
		city + ' ' + extra;
}
function goReturn(e) 
{
	if(e == null) e = window.event;
	return (e.keyCode == 13);
}

function DictionarySearch(word)
{
	window.open('http://dictionary.reference.com/browse/' + word,'dictionary');
}

function StockHandler(exchange,quote)
{
	//alert(document.getElementById('exchange').value);
	if(exchange == "NYSE")
	{
		window.open('http://www.nyse.com/about/listed/quickquote.html?ticker='+quote,'Stocks');
	}
	else if(exchange == "London")
	{
		window.open('http://www.londonstockexchange.com/en-gb/pricesnews/prices/Trigger/genericsearch.htm?bsg=true&ns='+quote,'Stocks');
	}
	else if(exchange == "Paris")
	{
		window.open('http://www.euronext.com/quicksearch/resultquicksearch-2986-EN.html?restrict=euronext_en&matchpattern='+quote+'&fromsearchbox=true&path=/quicksearch&searchTarget=quote','Stocks');
	}
	else if(exchange == "NASDAQ")
	{
		window.open('http://quotes.nasdaq.com/quote.dll?mode=stock&page=quick&symbol='+quote,'Stocks');
	}
	else if(exchange == "Saudi")
	{
		window.open('http://www.tadawul.com.sa/wps/portal/!ut/p/_s.7_0_A/7_0_4BC?companySymbol=&ANN_ACTION=ANN_SEARCH&symbol='+quote+'&tabOrder=1&s8fid=2119194107721','Stocks');
	}
}

function SetSearchBar(val)
{
	document.getElementById('query').value=val;
}

function SetSearch(val,box)
{
	document.location.href = val;
//	document.getElementById(box).value=val;
}

function openLink(id,special)
{
	var extra = '';
	if(special != null)
		extra = '&sp=' + special;
	
	window.open('http://www.enetez.com/thankyou.php?id='+id + extra,'adwindow','width=500,height=400,resizable=1');
}
