var navproduct = navigator.product;
var vnum = navigator.appVersion.substring(0,1)

if (navproduct!='Gecko')
{
	if (parseInt(vnum) < 4) {
		if (self.location.href.indexOf("sorry.html")==-1)
			self.location.href = "../sorry.html";
	}
	else
	{
		//====== Mac-IE 4.5 send to Sorry page
		if ((navigator.appVersion.indexOf("MSIE 4.5")!=-1) && (navigator.userAgent.indexOf('Mac')!=-1)) {	// vch 2004/07/22 sdf2788
			if (self.location.href.indexOf("sorry.html")==-1)
				self.location.href = "../sorry.html";
		}
		else {
			mac = false;

			var e4 = (document.all)? true:false;

			// BEGIN 2004/07/22 sdf2788 vch in Netscape 4.75, sometimes document.layers will trigger an error and stop redirection
			// processing, so trap it here and send it away if I know I am not IE4
			//WebSiteRenewal-Uncommented by Y.Ogura on 22-April-2009
			//if (!e4) if (self.location.href.indexOf("sorry.html")==-1) self.location.href = "sorry.html";
			// END

			var n4 = (document.layers)? true:false;
			var n6 = (document.getElementById)? true:false;	// non-gecko, standard-compliant browser
			var e5 = e4 && n6;	// IE 5.0+ supports .all and .getElementById
			if (e4) n6=false;
			if (n4)
				if (self.location.href.indexOf("sorry.html")==-1) self.location.href = "../sorry.html";	// 2004/05/08 vch AXA++ no more NN4

			//======== for Macintosh
			if(navigator.userAgent.indexOf('Mac') != -1) {
				if(n6)
					document.write('<LINK REL="stylesheet" TYPE="text/Css" HREF="../Css/mac_safa.css" TITLE="Css for MAC-N6">');
				else
					document.write('<LINK REL="stylesheet" TYPE="text/Css" HREF="../Css/mac_ie.css" TITLE="Css for MAC-IE">');
			}
			//======== for Windows
			else {
				if(e4)
					document.write('<LINK REL="stylesheet" TYPE="text/Css" HREF="../Css/win_ie.css" TITLE="Css for WIN-IE">');
				if(n6)
					document.write('<LINK REL="stylesheet" TYPE="text/Css" HREF="../Css/mac_safa.css" TITLE="Css for MAC-IE">');
				onerror = errorhandle;
			}
		}
	}
}
else
{
	document.write('<LINK REL="stylesheet" TYPE="text/Css" HREF="../Css/mac_safa.css" TITLE="Css for MAC-SAFA">');
}

function errorhandle() {
	return true;
}

//====== reloads when browser is resized
function init(){
	 initsNaviBg();
 }
function redo() {
	if (innerWidth != origWidth || innerHeight != origHeight) {
		//location.reload();
	 }
 }


var tNavi = new Image(); 
tNavi.src = "../Image/tnavi_on.gif"; 

//=== topNavi
function tNaviBg(targetLayer, vstatus){

/*	if(document.all){
	document.all[targetLayer].style.visibility = vstatus;
	}
	if(document.layers){
	document.layers[targetLayer].visibility = vstatus;
	}
*/
	if(document.getElementById(targetLayer)){
		document.getElementById(targetLayer).style.visibility = vstatus;
	}
}

//--initiate side menu
var sNaviBon = new Image(); 
sNaviBon.src = "../Image/sidenavi_on.gif"; 
var sNaviBoff = new Image(); 
sNaviBoff.src = "../Image/sidenavi_off.gif"; 
function initsNaviBg(){
   if(document.getElementById("sNaviIndex")){
	    n = document.getElementById("sNaviIndex").value ;
    	document.getElementById("s3Navi"+n).style.visibility="hidden";
	    document.getElementById("s4Navi"+n).style.visibility="hidden";
   }   
}
//=== sideNavi
function setsNaviOn(sNaviName){
	if (document.getElementById(sNaviName)){
    	if (document.images) {
        	document.getElementById(sNaviName).src = sNaviBon.src;
	    }
    }
}

function setsNaviOff(sNaviName){
	if (document.getElementById(sNaviName)){
    	if (document.images) {
        	document.getElementById(sNaviName).src = sNaviBoff.src;
	    }
    }
}

//=== sideNavi
function showsNavi(n){ 
	document.images["snavi"+n].src = "../Image/snavi_on.gif"; 
 } 
function hidesNavi(n){ 
	document.images["snavi"+n].src="../Image/snavi_off.gif";
 }

// CHR900
function campaign(bannerCode)
{
	switch(bannerCode)
	{
	case 103:
		postForm("Quote", bannerCode);
		break;
	case 121:	// vch chr1418 20030602
		postForm("Quote", bannerCode);
		break;
	case 125:	// jyl chr2223 2004/07/20
		postForm("Quote", bannerCode);
		break;
	}//switch
}

// Moved to here from postform, we need it as a global var
var url = "";
var urlAction = "";

function postForm(origin, banner)
{
	var strXml;
	var path;
	var urlWithoutHTTPS = "../";

	if (window.location.protocol != "https:")
	{	// Ensure that I'm using SSL
		path = window.location.pathname;
		if ((path.substr(path.length-4,4) == ".asp")||(path.substr(path.length-4,4) == ".htm")
			||(path.substr(path.length-5,5) == ".html")||(path.substr(path.length-1,1) == "/"))
		{
			path = path.substring(0, path.lastIndexOf("/"));	// backup to trim file
			//path = path.substring(0, path.lastIndexOf("/")+1);	// backup one directory
		}
		path = path.substring(0, path.lastIndexOf("/")+1);	// backup one directory
		url = "https://" + window.location.hostname + path;
		urlWithoutHTTPS = "http://" + window.location.hostname + path;
		urlAction = url;
	}
	else
	{
		urlWithoutHTTPS = "../";
		url = "../";
		urlAction = "";
	}

	switch (origin)
	{
	case "PAM" :
				{
				// 2005/12/20 vch .NET - Static->Dynamic : from Top Page Axa File to login page
				window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=loginPage";
				break;
				}
	case "login" : 
				{
				// 2005/12/20 vch .NET - Static->Dynamic : from Top Page click on login button
				if (loginFirst == false)
				{
					window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=login";
					loginFirst = true;
				}
				break;
				}
	case "getPassword" : 
				{
				window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=getPassword";
				break;
				}

	case "easyQuote" : 
				{
				// 2005/12/20 vch .NET - Static->Dynamic : from Top Page click on easy quote button
				window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=EasyQuote";
				break;
				}
	case "Quote" : 
				{
				// 2005/12/20 vch .NET - Static->Dynamic : from Top page ID Registration button to ID Registration page
				// window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=Registration;
				// 2006/05/01 for supporting legacy bannerCode
				window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=Registration&BannerCode="+ banner;
				break;
				}
	case "IntEmail" :
				{
				// 2006/03/08 L.Wang .NET - Static->Dynamic : from Top Page Axa File to InteractEmailFull Page
				window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=InteractEmailFullDetail";
				break;
				}		
	case "Pamphlet" :
		{
		// 2005/12/29 vch .NET - Static->Dynamic : from Top page Pamphlet button to Pamphlet page
		window.location = "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=Pamphlet";
		break;
		}

	}
}

var onelogin=false;
function newaxawindow(aform)
{
	if (onelogin == true) return false;

	onelogin = true;

	var url = "";
	var urlWithoutHTTPS = "";
	if (window.location.protocol != "https:")
	{	// Ensure that I'm using SSL
		path = window.location.pathname;
		if ((path.substr(path.length-4,4) == ".asp")||(path.substr(path.length-5,5) == ".aspx")||
			(path.substr(path.length-4,4) == ".htm")||(path.substr(path.length-5,5) == ".html"))
		{
			path = path.substring(0, path.lastIndexOf("/")+1);	// backup to trim file
		}

		url = "https://" + window.location.hostname + path;
		urlWithoutHTTPS = "http://" + window.location.hostname + path;
	}

	aform.action = url + "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=login";
	return true;
}

function newaxawindow_dotnet(aform)
{
	if (onelogin == true) return false;

	onelogin = true;

	var url = "";
	var urlWithoutHTTPS = "";
	if (window.location.protocol != "https:")
	{	// Ensure that I'm using SSL
		path = window.location.pathname;
		if ((path.substr(path.length-4,4) == ".asp")||(path.substr(path.length-5,5) == ".aspx")||
			(path.substr(path.length-4,4) == ".htm")||(path.substr(path.length-5,5) == ".html"))
		{
			path = path.substring(0, path.lastIndexOf("/")+1);	// backup to trim file
		}

		url = "https://" + window.location.hostname + path;
		urlWithoutHTTPS = "http://" + window.location.hostname + path;
	}

	aform.action = url + "../eCAM/StaticDispatcher/StaticDispatcher.aspx?entry=login";
	return true;
}

function errorManagement()
{
	if (document.error.Error_Field.value != "")
		alert(document.error.Error_Field.value);
}

