//功能说明：检察字符串里是否是合法的email地址
//参数说明：要检察的字符串地址
//返回值说明：0：非法的email格式，1：正确的email地址
function fucCheckemail(a)
{
	var temp1, temp2, str_leng;
	str_leng = a.length;
	temp1 = a.indexOf('@');
	temp2 = a.indexOf('.');
	if((temp1 > 0) && (temp2 >= 0))
	{
		return 1;
	}
	return 0;
}

//Author: 	william
//Date:		2006-11-05
//Function: 	goto the mail Server
function GoToMailServer(theUrl,uName,uPwd)
{
	var chkLite = document.logon.chkLite;
	if(chkLite.checked)
	{
		chkLite.value = "true";
	}
	else
	{
		chkLite.value = "false";
	}
	
	actionto =  theUrl + "/iclient/Login.aspx";
	document.logon.txtmailHosting.value = theUrl;
	document.logon.action=actionto;	
	document.logon.target="_bank";
	document.logon.submit();		
}

//submit 
function GoTo()
{
	var a=document.logon;	
	if(check(a))
	{
		
		var mail = a.userid.value; 
		var pwd = a.passwd.value;
		var index = mail.indexOf("@");
		var len = mail.length;
		var mailright = mail.substring(index,len).toLowerCase();  //=========== All return  to LowerCase. william add 2007-06-08
		var actionto;
		
		//================================================================Begin login.aspx

		//====== A -- G ========
		
	    if(mailright=="@modernspace.com.hk")             // added  by Sam  7-14-2011                              
		{
			//GoToMailServer("http://mail.modernspace.com.hk",mail,pwd);
			GoToMailServer("http://mail.ssbgit.com",mail,pwd);
			return;
		}
		else if(mailright=="@porschechina.cn")             //                                  
		{
			GoToMailServer("http://mail.porschechina.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}	
		else if(mailright=="@nickschina.com")             //                                  
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@demonchy.cn")    //2012-01-11 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@jtpchina.cn")    //2012-02-08 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@kenas.cn")    //2012-02-08 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@austrofin.cn")    //2012-02-08 by  Elaine                   
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@chinasense.cn")  //2012-02-08 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@idc.cn.com")    //2012-02-08 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@elders.com.cn")  //2012-02-01 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@kushilifestyle.com")//2012-01-16byElaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@cabinc.com.cn")  //2012-01-12 by  Elaine                           
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@kirribillipastoral.com")        //
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-jinan.com")             //                                 
		{
			GoToMailServer("http://mail.porsche-jinan.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-wuxi.com")             //                                 
		{
			GoToMailServer("http://mail.porsche-wuxi.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}	
		else if(mailright=="@porsche-taiyuan.com")             //                                  
		{
			GoToMailServer("http://mail.porsche-taiyuan.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}	
		else if(mailright=="@aeclight-reel.com")             //                                 
		{
			//GoToMailServer("http://mail.aeclight-reel.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-jinhua.com")             //                                  
		{
			GoToMailServer("http://mail.porsche-jinhua.com",mail,pwd);
			return;
		}
		else if(mailright=="@dashbrands.com")             // add by william 2009-03-06                                
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		
		else if(mailright=="@prosperitygroup.cn")             // add 2008-10                                
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}		
		else if(mailright=="@porsche-dongguan.com")             // add 2008-12                               
		{
			GoToMailServer("http://mail.porsche-dongguan.com",mail,pwd);
			return;
		}
		
		else if(mailright=="@adamas.com.cn")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@asiamedia.net")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@jinding.com")  // 
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}	
		else if(mailright=="@southernbelle.com.cn")  // 
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@triding.com")  // 
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
	
		else if(mailright=="@cathay-sub.com")          //add in 2007-4-26                  
		{
			//GoToMailServer("http://mail.cathay-sub.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@chinaoffice.biz")          // add in 2008-4-11                  
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@elecord.com.cn")
		{	
			GoToMailServer("http://mail.elecord.com.cn",mail,pwd);
			//GoToMailServer("http://202.64.181.48",mail,pwd);
			return;
		}
		else if(mailright=="@elecord.com")// 2006-11-13 add
		{	
			GoToMailServer("http://mail.elecord.com",mail,pwd);
			//GoToMailServer("http://211.152.151.11",mail,pwd);
			return;
		}
		else if(mailright=="@esfc.com.cn")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);	
			return;
		}
		else if(mailright=="@fosterpartners.com.cn")		
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@fpselection.com.cn")		
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);	
			return;
		}

		//======= H -- N =======
		else if(mailright=="@historic-shanghai.com")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		
		else if(mailright=="@hutchin.com.cn")
		{	
			GoToMailServer("http://mail.hutchin.com.cn",mail,pwd);
			//GoToMailServer("http://202.64.181.48",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-bj-yizhuang.com")
		{
			GoToMailServer("http://mail.porsche-bj-yizhuang.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@hutchin.com")// 2006-11-13 add	
		{	
			GoToMailServer("http://mail.hutchin.com",mail,pwd);
			//GoToMailServer("http://211.152.151.11",mail,pwd);	
			return;
		}
		else if(mailright=="@porsche-haikou.com")// ================Add by William (2008-02-25)6
		{
			GoToMailServer("http://mail.porsche-haikou.com",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-harbin.com")
		{
			GoToMailServer("http://mail.porsche-harbin.com",mail,pwd);
			return;
		}
		else if(mailright=="@jjmshanghai.com")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@nrges.ie") 
		{
			//GoToMailServer("http://mail.nrges.ie",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		//=========== O -- Z ========== 
		//osborne-asia.com"(211.152.149.206)  === 2007-01-04
		else if(mailright=="@osborne-asia.com") //add in 2006-12-19
		{
			//GoToMailServer("http://mail.osborne-asia.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-ningbo.com") //================2008-08-03 by William Begin===========================
		{
			GoToMailServer("http://mail.porsche-ningbo.com",mail,pwd);
			//GoToMailServer("http://116.213.96.116",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-bj-haidian.com") //================2008-08-03 by William===========================
		{
			GoToMailServer("http://mail.porsche-bj-haidian.com",mail,pwd);
			//GoToMailServer("http://116.213.96.116",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-changsha.com") //================2008-08-03 by William===========================
		{
			GoToMailServer("http://mail.porsche-changsha.com",mail,pwd);
			//GoToMailServer("http://116.213.96.116",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-fuzhou.com") 
		{
			GoToMailServer("http://mail.porsche-fuzhou.com",mail,pwd);
			//GoToMailServer("http://116.213.96.116",mail,pwd);
			return;
		}	//================2008-08-03 by William End===========================
		else if(mailright=="@porsche-beijing1.com")		
		{
			GoToMailServer("http://mail.porsche-beijing1.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-beijing3s.com")		   //=========================== add in 2007-4-26  
		{
			GoToMailServer("http://mail.porsche-beijing3s.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-club-shanghai.com") // 2006-11-17 add by william
		{
			GoToMailServer("http://mail.porsche-club-shanghai.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
			else if(mailright=="@porsche-beijing2.com")		
		{
			GoToMailServer("http://mail.porsche-beijing2.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-chengdu.com")		
		{
			GoToMailServer("http://mail.porsche-chengdu.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-lanzhou.com")		//=====Add in 20111205 by Elaine
		{
			GoToMailServer("http://mail.porsche-lanzhou.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-nantong.com")		//=====Add in 20120110 by Elaine
		{
			GoToMailServer("http://mail.porsche-nantong.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}	
		else if(mailright=="@porsche-zhengzhou.com")		
		{
			GoToMailServer("http://mail.porsche-zhengzhou.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-chongqing.com")		
		{
			GoToMailServer("http://mail.porsche-chongqing.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-dalian.com")		
		{
			GoToMailServer("http://mail.porsche-dalian.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-guangzhou.com")		
		{
			GoToMailServer("http://mail.porsche-guangzhou",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-hangzhou.com")		
		{
			GoToMailServer("http://mail.porsche-hangzhou.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-liaoning.com") // 2006-12-14 add 
		{
			GoToMailServer("http://mail.porsche-liaoning.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-qingdao.com")		
		{
			GoToMailServer("http://mail.porsche-qingdao.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-shenyang.com")		
		{
			GoToMailServer("http://mail.porsche-shenyang.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-shengyang.cn")		//=========================== add in 2007-4-26  
		{
			GoToMailServer("http://mail.porsche-shengyang.cn",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-shanghai.com")		
		{
			GoToMailServer("http://mail.porsche-shanghai.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-xiamen.com")		
		{
			GoToMailServer("http://mail.porsche-xiamen.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-wuhan.com")		
		{
			GoToMailServer("http://mail.porsche-wuhan.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-nanjing.com")                            //2007-04-16 lisa		
		{
			GoToMailServer("http://mail.porsche-nanjing.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-wenzhou.com")                            //add 2007-08-07		
		{
			GoToMailServer("http://mail.porsche-wenzhou.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-xian.com")		// add in 2007-4-26  
		{
			GoToMailServer("http://mail.porsche-xian.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-tianjin.com")		//add in 2007-4-26  
		{
			GoToMailServer("http://mail.porsche-tianjin.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@porsche-kunming.com")		//add in 2007-4-26  
		{
			GoToMailServer("http://mail.porsche-kunming.com",mail,pwd);
			//GoToMailServer("http://210.14.66.33",mail,pwd);
			return;
		}
		else if(mailright=="@sinojie.com")
		{
			//GoToMailServer("http://mail.sinojie.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@ssbglist.com")
		{
			GoToMailServer("http://mail.ssbglist.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@summergate.com")
		{
			GoToMailServer("http://mail1.ssbg.com.cn",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@ssbgit.com" ) 		
		{	
			GoToMailServer("http://mail.ssbgit.com",mail,pwd);
			//GoToMailServer("http://202.64.181.48",mail,pwd);
			return;	
		}
	    else if(mailright=="@ssbgit.com.hk" ) 	//================ none (2007-01-07)	
		{	
			GoToMailServer("http://mail.ssbgit.com.hk",mail,pwd);
			//GoToMailServer("http://202.64.181.48",mail,pwd);
			return;	
		}
		else if(mailright=="@ssbg-china.com" )	
		{	
			//GoToMailServer("http://mail.ssbg-china.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;	
		}	
		else if (mailright=="@ssbg.com.cn")
		{
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);

			return;
		}
		else if (mailright=="@colinbuchanan.cn")
		{
			document.logon.action="http://210.73.205.203/exchange";	
			document.logon.target="_bank";
			document.logon.submit();
			return;
		}
		else if (mailright=="@ssbg.com") //2008-09-06 william
		{
			document.logon.action="http://210.73.205.203/exchange";	
			document.logon.target="_bank";
			document.logon.submit();
			return;
		}
		else if(mailright=="@rsadesign.com.cn")   //William Edit 2008-09-06
		{
			document.logon.action="http://mail.rsadesign.com.cn/exchange";	
			document.logon.target="_bank";
			document.logon.submit();
			return;
		}
		else if(mailright=="@robartsinteriors.com")   //Sam Edit 2011-07-14
		{
			document.logon.action="http://mail.robartsinteriors.com/exchange";	
			document.logon.target="_bank";
			document.logon.submit();
			return;
		}
		else if (mailright=="@ssbg.com.hk")   ///-------------------------------add 2007-08-07
		{
			GoToMailServer("http://mail.ssbg.com.hk",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if (mailright=="@ssbg.cn") //=====================================add 2007-7-23
		{
			GoToMailServer("http://mail.ssbg.cn",mail,pwd);
			//GoToMailServer("http://mail.ssbg.cn",mail,pwd);
			return;
		}
		else if(mailright=="@ssbglist.com" ) 	// =============== none 2007-01-07	
		{	
			GoToMailServer("http://mail.ssbglist.com",mail,pwd);
			//GoToMailServer("http://61.152.172.178",mail,pwd);
			return;	
		}
		else if (mailright=="@stromag-china.com") // ===============add 2007-01-04
		{
			//GoToMailServer("http://mail.stromag-china.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@stshanghai.com")
		{
			//GoToMailServer("http://mail.stshanghai.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@summergate.com")
		{
			GoToMailServer("http://mail.summergate.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@summergate.com.hk" ) //=================none (2007-01-07) 		
		{	
			GoToMailServer("http://mail.summergate.com.hk",mail,pwd);
			//GoToMailServer("http://202.64.181.48",mail,pwd);
			return;	
		}
		else if(mailright=="@synthesisenergy.com")
		{
			GoToMailServer("http://mail.synthesisenergy.com",mail,pwd);
			//GoToMailServer("http://211.152.149.206",mail,pwd);
			return;
		}
		else if(mailright=="@technomicasia.com")		
		{
			//GoToMailServer("http://mail.technomicasia.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@thesalzergroupsh.com")
		{
			GoToMailServer("http://mail.thesalzergroupsh.com",mail,pwd);
			return;
		}
		else if(mailright=="@tmi.sh")	//2008-03-12 william
		{
			//GoToMailServer("http://mail.tmi.sh",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}		
		else if(mailright=="@wessco-cn.net")
		{
			//GoToMailServer("http://mail.wessco-cn.net",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else if(mailright=="@yessamin.com")
		{
			//GoToMailServer("http://mail.yessamin.com",mail,pwd);
			GoToMailServer("http://mail.ssbg.com.cn",mail,pwd);
			return;
		}
		else 
		{
			actionto = "";
			alert("Your domain doesn't exists in our web Mail!Please contact your email administrator");
			return false;			
		}
		
		if(actionto != "")
		{
			document.logon.action=actionto;
			document.logon.target="_bank";
			document.logon.submit();
		}
	}
}

//Check input's Value
function check(a)
{//验证转页的条件
	if(!a.userid.value)
	{//检查是否有输入
		alert("Please input your email address!");
		a.userid.focus();
		return false;
	}

	if(!a.passwd.value)
	{//检查是否有输入
		alert("Please input your password!");
		a.passwd.focus();
		return false;
	}	
	if(!fucCheckemail(a.userid.value))
	{
		alert("Please input your email address!");
		a.userid.focus();
		return false;
	}	
	return true;
}

function GoUrl(EmailPostfix)
{
	switch(postfix)
	{
		case "@ssbg.com.cn":		
			actionto="http://mail.ssbg.com.cn/login.cgi";			
			document.logon.action=actionto;
			document.logon.submit();
			break;
	}
}



	   
