var Share_win=null;
var Options_win=null;
var Secretial_win=null;
var CompanyLaw_win = null;
var InfoServices_win = null;
var Offshore_win = null;
var Specialists_win = null;
var name_search_win;
var link_base = "http://shergar/help/"
link_base = "./help/"

isIE = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ));

isNS =  ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 ));

function OpenOptions() {
	if (Options_win && Options_win.open && !Options_win.closed) {
		Options_win.focus();
	} else {
		if (isIE) {
			Options_win=window.open(link_base + "option_packages.asp", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=595,width=550,left=1,top=1");
			Options_win.focus();
		} else {
			Options_win=window.open(link_base + "option_packages.asp", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=585,width=550,screenX=1,screeny=1,alwaysraised");
			Options_win.focus();
		}
	}
}

function OpenInfoServices() {
	if (InfoServices_win && InfoServices_win.open && !InfoServices_win.closed) {
		InfoServices_win.focus();
	} else {
		if (isIE) {
			InfoServices_win=window.open(link_base + "info_services_help.asp", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=630,width=520,left=1,top=1");
			InfoServices_win.focus();
		} else {
			InfoServices_win=window.open(link_base + "info_services_help.asp", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=630,width=520,screenX=1,screeny=1,alwaysraised");
			InfoServices_win.focus();
		}
	}
}

function OpenCompanyLaw() {
	if (CompanyLaw_win && CompanyLaw_win.open && !CompanyLaw_win.closed) {
		CompanyLaw_win.focus();
	} else {
		if (isIE) {
			CompanyLaw_win=window.open(link_base + "law_help.htm", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=620,width=540,left=1,top=1");
			CompanyLaw_win.focus();
		} else {
			CompanyLaw_win=window.open(link_base + "law_help.htm", "Options", "toolbar=no,resizable=yes,scrollbars=yes,height=615,width=540,screenX=1,screeny=1,alwaysraised");
			CompanyLaw_win.focus();
		}
	}
}

function OpenShareCapital() {
	if (Share_win && Share_win.open && !Share_win.closed) {
		Share_win.focus();
	} else {
		if (isIE) {
			Share_win=window.open(link_base + "share_help.htm", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=540,width=600,left=1,top=1");
			Share_win.focus();
		} else {
			Share_win=window.open(link_base + "share_help.htm", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=535,width=600,screenX=1,screeny=1,alwaysraised");
			Share_win.focus();
		}
	}
}

function OpenSecreterial() {
	if (Secretial_win && Secretial_win.open && !Secretial_win.closed) {
		Secretial_win.focus();
	} else {
		if (isIE) {
			Secretial_win=window.open(link_base + "secreterial_help.asp", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=630,width=660,left=1,top=1");
			Secretial_win.focus();
		} else {
			Secretial_win=window.open(link_base + "secreterial_help.asp", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=620,width=660,screenX=1,screeny=1,alwaysraised");
			Secretial_win.focus();
		}
	}
}

function OpenNameSearch() {
	if (name_search_win && name_search_win.open && !name_search_win.closed) {
		name_search_win.focus();
	} else {
		if (isIE) {
			name_search_win=window.open("name_search.htm", "Check", "toolbar=no,resizable=yes,scrollbars=yes,height=500,width=670,left=1,top=1");
			name_search_win.focus();
		} else {
			name_search_win=window.open("name_search.htm", "Check", "toolbar=no,resizable=yes,scrollbars=yes,height=520,width=670,screenX=1,screeny=1,alwaysraised");
			name_search_win.focus();
		}
	}
}

function OpenOffshorePrice(){
	if (Offshore_win && Offshore_win.open && !Offshore_win.closed) {
		Offshore_win.focus();
	} else {
		if (isIE) {
			Offshore_win=window.open(link_base + "offshore_price_list.asp", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=650,width=560,left=1,top=1");
			Offshore_win.focus();
		} else {
			Offshore_win=window.open(link_base + "offshore_price_list.asp", "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=640,width=560,screenX=1,screeny=1,alwaysraised");
			Offshore_win.focus();
		}
	}
}

function OpenSpecialists(help_file,thisAnchor){
	if (Specialists_win && Specialists_win.open && !Specialists_win.closed) {
		if (Specialists_win.name==help_file) {
			Specialists_win.focus();
		}else{
			Specialists_win.close();
			OpenSpecialists(help_file);
		}
	} else {
		if (isIE){
			Specialists_win=window.open(link_base + help_file+".htm#" + thisAnchor, "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=450,width=580,left=1,top=1");
			Specialists_win.focus();
		} else {
			Specialists_win=window.open(link_base + help_file+".htm#" + thisAnchor, "Help", "toolbar=no,resizable=yes,scrollbars=yes,height=440,width=580,screenX=1,screeny=1,alwaysraised");
			Specialists_win.focus();
		}
	}
}

function isNum(field) {
	if (field.value != '') {
		var regExp = /\D+/;
		var temp = field.value
		temp = temp.toString();
		temp = temp.split(".").join("");

		if (!regExp.test(temp)) {
			return true;
		}else{
			field.value=""
			return false;
		}
	} else {
		field.value=""
		return false;
	}
}

//ENLITE GLOBAL VARIABLES
var E_screen_width;
var E_isNav;
var E_isIE;
var E_Menu_Horizontal_Position;

function getDimensions() {
	if (parseInt(navigator.appVersion) >= 4) {
		if (navigator.appName == "Netscape") {
			E_isNav = true;
		} else {
			E_isIE = true;
		}
	}
	if (E_isNav) {
		E_screen_width = window.innerWidth;
	} else {		
		E_screen_width = document.body.clientWidth;
	}
	if (E_isNav) {
		if (E_screen_width > 750){
			E_Menu_Horizontal_Position = Math.ceil(((E_screen_width - 750) /2)+133);
		}else{
			E_Menu_Horizontal_Position = 150;
		}
	} else {
		if (E_screen_width > 750){
			E_Menu_Horizontal_Position = Math.round(((E_screen_width - 750) /2)+141);
		} else{
			E_Menu_Horizontal_Position = 150;
		}
	}
}

function getLeft() {
	if (typeof E_Menu_Horizontal_Position != "undefined") {
		return E_Menu_Horizontal_Position;
	}
}

if (!E_isNav) {
//	window.onresize=new Function("window.location.reload()");
}

function getRadioValue(field){
	if (typeof(field.length) == 'undefined'){
		return (field.value);
	}else{
		for (var i=0;i<field.length;i++) {
			if (field[i].checked == true) {
				return (field[i].value);
				break;
			}
		}
	}
}