sc_svr = "";
test_svr = "";
prod_svr = "www.info.gov.hk";
test_url = "";
prod_url = "http://www.info.gov.hk";
english = "/eng/";
chinese = "/chi/";
_url = top.location.href;

//url function
function istest(str_url){
	if (str_url.indexOf(test_svr) != -1){
		return true;
	}
	return false;
}

function bor_page(str_url){
	var lh = parent.location.href;
	if (lh.indexOf("dec_")!=-1) {
		top.location.href= "/bor/chi/index.htm";
	} else {
		if (str_url.search("/eng/")!=-1) {
			lh = lh.replace("/chi/", "/eng/");
			lh = lh.replace("/chs/", "/eng/");
			parent.location.href = lh;
		} else {
			lh = lh.replace("/eng/", "/chi/");
			lh = lh.replace("/chs/", "/chi/");
			parent.location.href = lh;
		}
	}
}

function gb_page(str_url){
	var lh = parent.location.href;
	if (lh.indexOf("dec_")!=-1) {
		top.location.href= "/bor/chs/index.htm";
	} else {
		lh = lh.replace("/eng/", "/chs/");
		lh = lh.replace("/chi/", "/chs/");
		parent.location.href = lh;
	}
}

function simp_chinese(){
	var lh = parent.location.href;
	lh = lh.replace("/eng/", "/chs/");
	lh = lh.replace("/chi/", "/chs/");
	parent.location.href = lh;
}

function trad_chinese(){
	var lh = parent.location.href;
	lh = lh.replace("/eng/", "/chi/");
	lh = lh.replace("/chs/", "/chi/");
	parent.location.href = lh;
}

function stn_english(){
	var lh = parent.location.href;
	lh = lh.replace("/chs/", "/eng/");
	lh = lh.replace("/chi/", "/eng/");
	parent.location.href = lh;
}


// general functions
function win_popup(str_url,str_winname,int_width,int_height,str_feature){
	if (!str_feature){
		str_feature = 'toolbars='	+ 'no'
		+ ',top='			+ '100'
		+ ',left='			+ '100'
		+ ',width=' 			+ int_width
		+ ',height=' 			+ int_height
		+ ',scrollbars='		+ 'no'
		+ ',resizable='			+ 'no'
		+ ',screenX='			+ '0'
		+ ',screenY='			+ '0'
		+ ',status='			+ 'no' 
	}
	
	var win = window.open(str_url, str_winname , str_feature);		
	win.focus();
	//return win;
}

// url functions

function getfoldername(){
	 
	 private_str_path = location.href;
	 private_int_len_path = private_str_path.length;
	 private_str_subpath = private_str_path.substring (7,private_int_len_path);
	 private_int_subpathid = private_str_subpath.lastIndexOf("/");
	 private_str_subpath = private_str_subpath.substring(0,private_int_subpathid);
	 private_int_subpathid = private_str_subpath.lastIndexOf("/");
	 private_int_len_path = private_str_subpath.length;
	 private_str_subpath = private_str_subpath.substring (private_str_subpath+1,private_int_len_path);
	 return private_str_subpath;
	 
}

function getfilename(){
	
	private_str_path = location.href;
	private_int_fileid = private_str_path.lastIndexOf("/");
	private_int_filesubid = private_str_path.lastIndexOf(".");
	private_str_filename = private_str_path.substring(private_int_fileid+1,private_int_filesubid);
	return private_str_filename;
}



//swap image functions
function si_over(str_image_name , str_path){
	document[str_image_name].src = str_path;
}

function si_out(str_image_name , str_path){
	document[str_image_name].src = str_path;
}



