var w3c=(document.getElementById)?true:false;
var ns4=(document.layers)?true:false;
var ie4=(document.all && !w3c)?true:false;
var ie5=(document.all && w3c)?true:false;
var ns6=(w3c && navigator.appName.indexOf("Netscape")>=0)?true:false; 
var mac=(navigator.appVersion.indexOf("Mac")>0)?true:false;


var focuser = null;
var configurator = null;


function hideFooterShadow(m) {

	if (ns4)
	{
		//alert("n4");
		document.layers[m].display = 'none';

	}
	else if (ie5)
	{
		//alert("ie5");

	}
	else
	{
		//alert("others");
		document.getElementById(m).style.display="none";
		
	}


}





function openCC(link) {
	
	//if (configurator == null || configurator.closed) {
	//	configurator = window.open(link, "configurator");

	//}
	//else {
		var leftVal = (screen.width - 750) / 2;
		var topVal = (screen.height - 550) / 2;

		configurator = window.open(link, "configurator", "width=750,height=550,left="+leftVal+",top="+topVal+",status=no,scrollbars=1,resizable=1,toolbar=no,menubar=no");
		configurator.focus();
		
	//}
}

function openLink(link) {
	if (focuser == null || focuser.closed) {
		focuser = window.open(link,'ex','height=500,width=440,location=0,menubar=0,toolbar=0,status=0,scrollbars=1,resizable=0,directories=0');
	}
	else {
		focuser.focus();
	}
}


function onLoad() {
	try {
		if (opener != null )
		{//&& opener.location.href.indexOf("/opener.htm")) {
			configurator = opener;
		}
	}
	catch (e) {
		configurator = null;
	}
	//setHeightNS6();
}


/*function setHeightNS6(){
	// this is used by netscape 6 only.
	if (ns6)
	{
		//alert(window.innerHeight);
		document.getElementById("main2").style.height=window.innerHeight;
		if (document.getElementById("main3"))
			document.getElementById("main3").style.height=window.innerHeight;
	}
}*/




function openWindow() {
		var leftVal=(screen.width / 2) - 400;
		var topVal = (screen.height / 2) - 250;

		newWindow = window.open("", "newWin", "toolbar=no,location=no,scrollbars=no,width=800,height=500,left="+leftVal+",top="+topVal+"")
}




function openWin(url) {

	var leftVal = (screen.width - 750) / 2;
	var topVal = (screen.height - 550) / 2;

	myWin= open(url, "displayWindow", "width=750,height=550,status=no,scrollbars=1,resizable=1,toolbar=yes,menubar=no");
}

function popupDemo() {
	var leftVal = (screen.width - 600) / 2;
	var topVal = (screen.height - 450) / 2;

	demo= open("/demo/index.html", "demo", "width=600,height=450,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	demo.focus();
}

function popupDemo2(section) {
	var leftVal = (screen.width - 600) / 2;
	var topVal = (screen.height - 450) / 2;

	demo= open("/demo/"+section+".html", "demo", "width=600,height=450,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	demo.focus();
}

function popupDemo3(section) {
	var leftVal = (screen.width - 600) / 2;
	var topVal = (screen.height - 450) / 2;

	demo= open("/demo/en/"+section+".html", "demo", "width=600,height=450,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	demo.focus();
}

function popupWebxpress() {

	var leftVal = (screen.width - 780) / 2;
	var topVal = (screen.height - 560) / 2;
	
	Webxpress= open("https://www.webxpress.fidelity.com.hk/hkwebx/index.jsp", "Webxpress", "width=780,height=560,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	Webxpress.focus();

}

function popupWebReg() {

	var leftVal = (screen.width - 780) / 2;
	var topVal = (screen.height - 560) / 2;
	
	Webxpress= open("https://www.webxpress.fidelity.com.hk/hkwebx/index.jsp", "Webxpress", "width=780,height=560,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	Webxpress.focus();

}

function popupSimulator() {
	var leftVal = (screen.width - 610) / 2;
	var topVal = (screen.height - 480) / 2;

	myWin= open("/planinvestment/financial/simulator.html", "Simulator", "width=610,height=480,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
}

function popupConditions() {

	var leftVal = (screen.width - 620) / 2;
	var topVal = (screen.height - 480) / 2;
	
	conditions = open("/global/conditions.html", "conditions", "width=620,height=480,left="+leftVal+",top="+topVal+",status=no,scrollbars=1,resizable=1,toolbar=no,menubar=no");
	conditions.focus();

}


function popupen_disclaimer() {

	var leftVal = (screen.width - 400) / 2;
	var topVal = (screen.height - 200) / 2;
	
	disclaimer= open("/demo/en/disclaimer.html", "disclaimer", "width=400,height=200,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	disclaimer.focus();
}

function popupch_disclaimer() {

	var leftVal = (screen.width - 400) / 2;
	var topVal = (screen.height - 200) / 2;
	
	disclaimer= open("/demo/ch/disclaimer.html", "disclaimer", "width=400,height=200,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	disclaimer.focus();
}

function popupHorizonsCover() {
	var leftVal = (screen.width - 531) / 2;
	var topVal = (screen.height - 675) / 2;

	horizons= open("/newsnviews/horizons/viewlarger.html", "horizons", "width=531,height=675,left="+leftVal+",top="+topVal+",status=no,scrollbars=0,resizable=1,toolbar=no,menubar=no");
	horizons.focus();
}

/*function popupDemo() {
    window_detail = open('/placedeal/online/online_dealing_demo.html','OnlineDealingDemo','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,left=0,top=0, width=600,height=450');
    window_detail.focus();
} 
function clear_Text(id) { 
  var se    edElement = document.getElementById(id);
  if( selectedElement.value==selectedElement.defaultValue ) 
	  selectedElement.value='';
}
*/

function showBlock(m) 
{
	if (ns4)
	{
		//alert("n4");
		if (document.layers[m].display == 'none')	
			document.layers[m].display = 'block';
		else 
			document.layers[m].display = 'none';	
	}
	else if (ie5)
	{
		//alert("ie5");
		if (document.all(m).style.display == 'none')	
			document.all(m).style.display = 'block';
		else 
			document.all(m).style.display = 'none';
	}
	else
	{
		//alert("others");
		if (document.getElementById(m).style.display == "none")	
			document.getElementById(m).style.display="block";
		else 
			document.getElementById(m).style.display="none";
		
	}



}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_over = newImage("images/home-over.gif");
		about_me_over = newImage("images/about-me-over.gif");
		hobby_over = newImage("images/hobby-over.gif");
		news_over = newImage("images/news-over.gif");
		contact_over = newImage("images/contact-over.gif");
		preloadFlag = true;
	}
}


function onload_fun()
{
	document.getElementById('photoiframe').height = '638px;';
	document.getElementById('photoiframe').style.display = 'block';
	//document.getElementById('first_div').style.display = 'block';
}


