// JavaScript Document

// show or hide the list
function showList(index){
	var list = document.getElementById(index);
	if(list != null){
		if(list.style.display == "none") 
			{
				list.style.display = "";
				list.style.listStyle="none"
			}
		else list.style.display = "none"
	}
}

function open_newsletter()
{
window.open("index.php?page=content/newslettersubmission","_blank","statusbar=0,toolbar=0,menubar=0,directories=0,resizable=0,scrollbars=0, width=520, height=340")
}

/// inverstor login setting

function setSampleLogin(){
	if(document.inverstorLogin.sampleAct.checked){
		document.inverstorLogin.investorpass.value = "example-password";
		document.inverstorLogin.investorid.value = "example-user";
		document.inverstorLogin.action = "http://www.dragonproperty.com/investors/investor_login.asp?id=example&method=login";
	}else{
		document.inverstorLogin.investorpass.value = "";
		document.inverstorLogin.investorid.value = "";
		document.inverstorLogin.action ="http://www.dragonproperty.com/investors/investor_login.asp?form=passed";
	}

}

// get the paramater
function get_paramater(str, paramater){
	var url = document.URL
	var url = str;
	var start = url.indexOf("page=content/")

	//document.write(i);
	if (url.indexOf("&")!=-1) {
		end  = url.substr(start+13).indexOf("&");
	}
	else {
		end  = url.substr(start+13).indexOf("/");
	}
	if(end == -1)
			var page = url.substr(start+13)
	else
		var page = url.substr(start+13, end)	
	return page;
}

// get the paramater
function get_paramater2(str, paramater){
	var url = document.URL
	var url = str;
	var start = url.indexOf("page=content/")

	//document.write(i);
	temp = url.substr(start+13).indexOf("/");
	end  = url.substr(start+14+temp).indexOf("/");
	if(end == -1)
			var page2 = url.substr(start+14+temp)
	else
		var page2 = url.substr(start+14+temp, end)	
	return page2;
}

// auto selection of menu
function auto_selection(){
	page = get_paramater(document.URL, "page");
	page2 = get_paramater2(document.URL, "page2");
	this_menu=document.getElementById(page);

	if (this_menu!=undefined) 
	{
		this_menu.style.display = '';
	}
	this_navi=document.getElementById("navi_"+page);
	if (this_navi!=undefined) {
		this_navi.style.color="#000000";
		this_navi.style.fontWeight="bold";
	}
	this_menu2=document.getElementById(page2);
	if (this_menu2!=undefined) 
	{
		this_menu2.style.backgroundColor = '#EBECEE';
	}
	/*
alert(page);
		for (i= 0; i < document.links.length; i++)
	{
		alink = document.links[i].href;
		id = document.links[i].id;
		if(get_paramater(alink, "page") == page){
			document.getElementById(id).className = "current";
			document.getElementById(id.split("/")[0]).style.display = '';
		}
	}*/
	
}
	function changeCat(obj, g_id)
	{
		if (obj.id=="icuList") {
			window.location='?page=content/icu&member_group_id='+g_id;
		} else if (obj.id=="ituList"){
			window.location='?page=content/itu&member_group_id='+g_id;
		}
		else {
		window.location='?page=content/members&member_group_id='+g_id;
	}
	}