var sina = {
	$ : function(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}},
	isIE : navigator.appVersion.indexOf("MSIE")!=-1?true:false,
	addEvent : function(obj,eventType,func){if(obj.attachEvent){obj.attachEvent("on" + eventType,func);}else{obj.addEventListener(eventType,func,false)}},
	delEvent : function(obj,eventType,func){
		if(obj.detachEvent){obj.detachEvent("on" + eventType,func)}else{obj.removeEventListener(eventType,func,false)}
	},
	readCookie : function(l){var i="",I=l+"=";if(document.cookie.length>0){offset=document.cookie.indexOf(I);if(offset!=-1){offset+=I.length;end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;i=unescape(document.cookie.substring(offset,end))}};return i},
	writeCookie : function(O,o,l,I){var i="",c="";if(l!=null){i=new Date((new Date).getTime()+l*3600000);i="; expires="+i.toGMTString()};if(I!=null){c=";domain="+I};document.cookie=O+"="+escape(o)+i+c}
};
function LoginSelectClickOther(e){
	thisObj = e.target?e.target:event.srcElement;
	do{
		if(thisObj.id == "loginFldselect" || thisObj == document.showLogin.password) return;
		if(thisObj.tagName == "BODY"){LoginSelectClose();return;};
		thisObj = thisObj.parentNode;
	}while(thisObj.parentNode);
};
function clickLoginSelect(){
	if(sina.$("loginFldselectop").style.display == "block"){
		LoginSelectClose();
	}else{
		sina.$("loginFldselectop").style.display = "block";
		sina.addEvent(document.body,"click",LoginSelectClickOther);
	}
};
function LoginSelectClose(){
	sina.$("loginFldselectop").style.display = "none";
	sina.delEvent(document.body,"click",LoginSelectClickOther);
};
function LoginSelect(title){
	var titleName;
	switch(title){
		case "Head Quarter":
			document.showLogin.entry.value = "Head Quarter";
			titleName = "Head Quarter";
			break;
		case "Barrie":
			document.showLogin.entry.value = "Barrie";
			titleName = "Barrie";
			break;
		case "Belleville":
			document.showLogin.entry.value = "Belleville";
			titleName = "Belleville";
			break;
		case "Brantford":
			document.showLogin.entry.value = "Brantford";
			titleName = "Brantford";
			break;
		case "Cambridge":
			document.showLogin.entry.value = "Cambridge";
			titleName = "Cambridge";
			break;
		case "Collinwood":
			document.showLogin.entry.value = "Collinwood";
			titleName = "Collinwood";
			break;
		case "Guelph":
			document.showLogin.entry.value = "Guelph";
			titleName = "Guelph";
			break;
		case "Halton":
			document.showLogin.entry.value = "Halton";
			titleName = "Halton";
			break;
		case "Hamilton":
			document.showLogin.entry.value = "Hamilton";
			titleName = "Hamilton";
			break;
		case "Kingston":
			document.showLogin.entry.value = "Kingston";
			titleName = "Kingston";
			break;
		case "Kitchener":
			document.showLogin.entry.value = "Kitchener";
			titleName = "Kitchener";
			break;
		case "London":
			document.showLogin.entry.value = "London";
			titleName = "London";
			break;
		case "Niagara":
			document.showLogin.entry.value = "Niagara";
			titleName = "Niagara";
			break;
		case "Ottawa Center":
			document.showLogin.entry.value = "Ottawa Center";
			titleName = "Ottawa Center";
			break;
		case "Ottawa East":
			document.showLogin.entry.value = "Ottawa East";
			titleName = "Ottawa East";
			break;
		case "Ottawa West":
			document.showLogin.entry.value = "Ottawa West";
			titleName = "Ottawa West";
			break;
		case "Peterborough":
			document.showLogin.entry.value = "Peterborough";
			titleName = "Peterborough";
			break;
		case "Sarnia-Petrolia":
			document.showLogin.entry.value = "Sarnia-Petrolia";
			titleName = "Sarnia-Petrolia";
			break;
		case "St Catharine":
			document.showLogin.entry.value = "St Catharine";
			titleName = "St Catharine";
			break;
		case "St Thomas":
			document.showLogin.entry.value = "St Thomas";
			titleName = "St Thomas";
			break;
		case "Waterloo":
			document.showLogin.entry.value = "Waterloo";
			titleName = "Waterloo";
			break;
		
	};
	sina.$("loginFldselectdis").innerHTML = titleName;
	sina.writeCookie("loginType",title,2160,"sina.com.cn;path=/");
	if(document.showLogin.username.value != "" && document.showLogin.password.value != ""){
		document.showLogin.onsubmit();
	};
	LoginSelectClose();
};
function openLoginType(){
	if(document.showLogin.username.value != "" && document.showLogin.username.value.indexOf("@") == -1 && sina.$("loginFldselectdis").innerHTML == "Select Region"){
		sina.$("loginFldselectop").style.display = "block";
		sina.addEvent(document.body,"mousedown",LoginSelectClickOther);
	}
}