// JavaScript Document
function _id(id){return document.getElementById(id);}
function redirect(url){return document.location.href=url;}
function show(id){document.getElementById(id).style.display = '';}
function hide(id){document.getElementById(id).style.display = 'none';}

function showToggle(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = '';
	}else{
		document.getElementById(id).style.display = 'none';	
	}
}

function _on(obj){
	if(!obj.src)
		return;
	var orgSrc = obj.src;
	if(orgSrc.substr(orgSrc.length-8,4) == "_off"){
		var newSrc = orgSrc.substr(0,orgSrc.length-8)+"_on.gif";
	}else{
		var newSrc = orgSrc.substr(0,orgSrc.length-4)+"_on.gif";
	}
	obj.src = newSrc;
}

function _off(obj){
	if(!obj.src)
		return;
	var orgSrc = obj.src;
	if(orgSrc.substr(orgSrc.length-7,3) == "_on"){
		var newSrc = orgSrc.substr(0,orgSrc.length-7)+"_off.gif";
	}else{
		var newSrc = orgSrc.substr(0,orgSrc.length-3)+"_off.gif";
	}
	obj.src = newSrc;
}

function popup(url, name, width, height, scrollbars, resize){
	var str = "height=" + height + ",innerHeight=" + height;
	str += ",width=" + width + ",innerWidth=" + width;
	if(window.screen){
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		var xc = (aw - width) / 2;
		var yc = (ah - height) / 2;
		str += ",left=" + xc + ",screenX=" + xc;
		str += ",top=" + yc + ",screenY=" + yc;
		if(scrollbars)
			str += ",scrollbars=1";
		if(resize)
			str += ",resizable=1";
	}
	popupWindow = window.open(url, name, str);
	if (popupWindow.opener == null) popupWindow.opener = self;
}


function checkEmail(str) {
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(str)){
		return false;
	}else{
		return true
	}
	/*
	if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3,4})+$/.test(str)){
		return true;
	}
	return false;
	*/
}




