/* ****************************************************
 Web Application: Oneworld 
 File: file name
 Type: JavaScript library                      
 
 Date: 01/07/2004
         
 ***** Legal Notice *****
 The code contained within this page is the Intellectual property
 of Red Square Productions Pty Ltd and licensed to oneworld Management Company Ltd for 
 use only within the specified Web Application as per Clause 14
 of the "Development & Maintenance Agreement".
 

 This notice cannot be removed or altered.  
 
****************************************************  */


/* ****************************************************

	Application: Oneworld
	
	File: common.js
	
	Type: Javascript Source
	
	Desc: global js code library
	
	Comments: file duplicated from Olympics > SydHob > Roadtrain > Athletics
	
	Author: Fred Randell <fred@redsquare.com.au>
	Date:  01/08/00
	Version: 1.0.0
	
	***** Modification Details *****
	
	DATE  NAME  MODIFICATION

**************************************************** */

/* START JS Browser detect code */
var bow="n";
var bow1="n";

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);

if (bName == "Netscape" && bVer >= 3)
{
	bow = "ok";
	bow1 = "ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer > 3)
{
	bow = "ok";
	bow1="ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer >=2)
{
	bow = "ok";
}

var IS_AOL=0;

if (navigator.userAgent)
{
	if (navigator.userAgent.indexOf("AOL") >=0)
	{
		IS_AOL=1;
		bow1="n";
	}
}
else
{
	bow="n"
	bow1="n";
}
/* END JS Browser detect code */

/* general utility function that accepts parameters for url of filename (f),
target Window (t), 
menubar (m - yes/no), location (l - yes/no), 
scrollbars (s - yes/no), resizeable (r - yes/no), 
window width (w), window height (h). 
Default values are laid out in the function.

23/10: add directories and toolbar options (fred)*/

function openWindow(f, t, m, l, s, r, w, h, st, tool, d)
{
	var fn_filename = "";
	var fn_target = "_blank";
	var fn_menubar = "yes";
	var fn_location = "yes";
	var fn_scrollbars = "yes";
	var fn_resizable = "yes";
	var fn_width = "600";
	var fn_height = "400";
	var fn_status = "yes";
	var fn_toolbar = "yes";
	var fn_directories = "yes";
	
	if (arguments.length > 0)
	{
		if (f != "" || f != null) fn_filename = f;
		if (t != "" || t != null) fn_target = t;
		if (m == "no") fn_menubar = m;
		if (l == "no") fn_location = l;
		if (s == "no") fn_scrollbars = s;
		if (r == "no") fn_resizable = r;
		if (w > 0) fn_width = w;
		if (h > 0) fn_height = h;
		if (st == "no") fn_status = st;
		if (tool == "no") fn_toolbar = tool;
		if (d == "no") fn_directories = d;
	}
	
	self.name="mainWin";
	
    if (bow!="ok") return (true);
	
	argumentString = 'menubar='+fn_menubar+',location='+fn_location+',scrollbars='+fn_scrollbars+',resizable='+fn_resizable+',width='+fn_width+',height='+fn_height+',status='+fn_status+',toolbar='+fn_toolbar+',directories='+fn_directories;
	
	remote =  window.open(fn_filename,fn_target,argumentString);

    if (remote == null) return true;

    if(bow1 == "ok"){
		window.setTimeout('focusWin()',1000);
	}
	return (false);
}

function focusWin(){
	if(!remote.closed){
		remote.focus();
	}
}

function isEmpty(inStr){
	if(trim(inStr).length == 0){
		return true;
	}else{
		return false;
	}
}

/* go to a page in the main window */
function openPageInMain(pageUrl){
	if(!window.opener || window.opener.closed){
		window.opener = window.open(pageUrl,'','');
		return false;
	}else{
		window.opener.location = pageUrl;
		window.opener.focus();
		return false;
	}
}



function openExternalWinTerminalMap(strLink)
{
	return openWindow(strLink,"ExternalWin","yes","no","yes","yes","640","400","yes","no","no");
}


function openExternalWin(strLink)
{
	var oWidth = getBrowserWidth();
	var newWid = parseInt( oWidth.widthValue * 0.7 );
	
	return openWindow(strLink,"ExternalWin","yes","no","yes","yes",newWid,"480","yes","no","no");
}

/*
function openExternalWin(strLink)
{
	return openWindow(strLink,"ExternalWin","yes","no","yes","yes","800","600","yes","no","no");
}*/


function newsPrintWin(oLink)
{
	openWindow(oLink.href, 'nprint', 'no', 'no', 'yes', 'no', '760', '500', 'no', 'yes', 'no');
	return false;
}


function newsPDFWin(oLink)
{
	openWindow(oLink.href, 'npdf', 'no', 'no', 'yes', 'yes', '760', '500', 'no', 'yes', 'no');
	return false;

}

function commomPopup(f,t){
	return openWindow(f, t, 'no', 'no', 'no', 'no', 550, 500, 'no', 'no', 'no');
}


function doSubmitSearch(objForm)
{
	if(objForm.search_field.value =='')
	{
		return false;
	}
	else
	{
		return true;
	}
}

