﻿// JScript 文件
DefaultSetting();

function DefaultSetting()
{
		if(getCookie("operateIndex")!="")
		{
			if(getCookie("operateIndex").indexOf("Big")>=0)
			{
					action="Big";
			}
			else if(getCookie("operateIndex").indexOf("Middle")>=0)
			{
					action="Middle";
			}
			else 
			{
				action="Small";	
			}
			SetPageFont(action);
		}
		else
		{
			SetPageFont("Small");
		}
}
function getCookie(cookie_name)
{
	if(document.cookie.indexOf(cookie_name)>=0)
	{
			/*cookie_array=unescape(document.cookie).split(";");*/
			return document.cookie.replace("operateIndex=","");
	}
}
function setCookie(cookie_value,expiredays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie="operateIndex="+escape(cookie_value)+((expiredays==null)?"":";expires="+exdate.toGMTString());
}

function SetPageFont(action)
{
	setCookie(action,30);
	switch(action)
    {
        case "Big":
            ts('body',18);
            break;
        case "Middle":
            ts('body',16);
            break;
        case "Small":
            ts('body',12);
            break;
    }
        ChangeWhyPic(action);
}

function ChangeWhyPic(action)
{
    if(document.URL.toLowerCase().indexOf("english")>=0)
	{
		if($("contentLabel"))
		{
			if(document.URL.indexOf("Guide.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/pic_e2.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/pic_e1.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/pic_e3.jpg' /></p>";
						break;
				}
			}
			else if(document.URL.indexOf("Audience.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic_e3.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic_e1.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/mainpic_e2.jpg' /></p>";
						break;
				}
			}
		}
	}
	else if(document.URL.toLowerCase().indexOf("japanese")>=0)
	{
		if($("contentLabel"))
		{
			if(document.URL.indexOf("Guide.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/pic_r2.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/pic_r1.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/pic_r3.jpg' /></p>";
						break;
				}
			}
			else if(document.URL.indexOf("Audience.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic_r3.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic_r2.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/mainpic_r1.jpg' /></p>";
						break;
				}
			}
		}
	}
	else
	{
		if($("contentLabel"))
		{
			if(document.URL.indexOf("Guide.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic1m.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic1.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/mainpic1s.jpg' /></p>";
						break;
				}
			}
			else if(document.URL.indexOf("Audience.aspx")>=0&&document.URL.indexOf("?")<0)
			{
				switch(action)
				{
					case "Big":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic2m.jpg' /></p>";
						break;
					case "Middle":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  alt='' src='/userfiles/mainpic2.jpg' /></p>";
						break;
					case "Small":
						$("contentLabel").innerHTML="<p style='text-align: center'><img  src='/userfiles/mainpic2s.jpg' /></p>";
						break;
				}
			}
		}
	}
}

function ts(action,FontSize)
{
    if($("titleLabel"))
    {
        $("titleLabel").style.fontSize=FontSize+8+"px";
    }
    if($("contentLabel"))
    {
        $("contentLabel").style.fontSize=FontSize+"px";
    }
    for(var i=0;i<document.getElementsByTagName("td").length;i++)
    {
        document.getElementsByTagName("td")[i].style.fontSize=FontSize+"px";
    }
	if(document.location.pathname.toLowerCase().indexOf("default.aspx")<0&&document.location.pathname!="/"&&document.location.pathname.toLowerCase()!="/english"&&document.location.pathname.toLowerCase()!="/japanese"&&document.location.pathname.toLowerCase()!="/english/"&&document.location.pathname.toLowerCase()!="/japanese/")
	{
		for(var i=0;i<document.getElementsByTagName("span").length;i++)
		{
			document.getElementsByTagName("span")[i].style.fontSize=FontSize+"px";
		}
		for(var i=0;i<document.getElementsByTagName("p").length;i++)
		{
			document.getElementsByTagName("p")[i].style.fontSize=FontSize+"px";
		}
		for(var i=0;i<document.getElementsByTagName("font").length;i++)
		{
			document.getElementsByTagName("font")[i].style.fontSize=FontSize+"px";
		}
		for(var i=0;i<document.getElementsByTagName("div").length;i++)
		{
			document.getElementsByTagName("div")[i].style.fontSize=FontSize+"px";
		}
	}
}

var tgs = new Array( 'div','td','tr');
function ts_old( trgt,inc ) 
{
    if (!document.getElementById) return
    var d = document,cEl = null,i,j,cTags;

    if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
    cEl.style.fontSize = inc;
    for ( i = 0 ; i < tgs.length ; i++ ) 
    {
        cTags = cEl.getElementsByTagName( tgs[ i ] );
        for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = inc;
    }
}
function kyf(demo,demo1,demo2,speed,style)
{

	document.getElementById(""+demo2).innerHTML=document.getElementById(""+demo1).innerHTML;
	if(style=="top")
	{
		function marquee_p()
		{
			if(document.getElementById(""+demo1).offsetHeight<=document.getElementById(""+demo).scrollTop)
			{
				document.getElementById(""+demo).scrollTop-=document.getElementById(""+demo1).offsetHeight;
			}
			else
			{
				document.getElementById(""+demo).scrollTop++;	
			}
		}
		var my=setInterval(marquee_p,speed);
	document.getElementById(""+demo).onmouseover=function(){clearInterval(my)};
	document.getElementById(""+demo).onmouseout=function(){my=setInterval(marquee_p,speed)};
	}
	else
	{
		function marquee_p1()
		{
			if(document.getElementById(""+demo1).offsetWidth<=document.getElementById(""+demo).scrollLeft)
			{
				document.getElementById(""+demo).scrollLeft-=document.getElementById(""+demo1).offsetWidth;
			}
			else
			{
				document.getElementById(""+demo).scrollLeft++;	
			}
		}
		var my1=setInterval(marquee_p1,speed);
	document.getElementById(""+demo).onmouseover=function(){clearInterval(my1)};
	document.getElementById(""+demo).onmouseout=function(){my1=setInterval(marquee_p1,speed)};
	}
}

function SubmitOk(button)
{  
     var obj;
      for(var i=0;i<document.getElementsByTagName("input").length;i++)
      {
           if(document.getElementsByTagName("input")[i].id.indexOf(button)>=0)
           {
                obj=document.getElementsByTagName("input")[i];
           }
      }
      
       if (event.keyCode == 13)

       {      

              event.keyCode=9;

              event.returnValue = false;

              obj.click();

       }

}
function $(_id){return document.getElementById(_id)}
function ChangePic(obj)
{
    $("BigPic").src=obj.src;
    $("pictitle").innerHTML=obj.title;
}
function CheckForm()
{
    var realname=$("RealnameControl").value;
    var cmp=$("CmpControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipcodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if(!isNaN(realname))
    {
        alert("姓名不能为数字或为空！");
        $("RealnameControl").focus();
        return false;
    }
    else if(!isNaN(cmp))
    {
        alert("工作单位不能为数字或为空！");
        $("CmpControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("请完整填写工作单位！");
        $("CmpControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("工作地址不能为数字或为空！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("请完整填写工作地址！字数最少5个");
        $("AddressControl").focus();
        return false;
    }
    else if(isNaN(zipcode))
    {
        alert("邮政编码请填写数字！字数最少5个");
        $("ZipcodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("电话号码请填写数字");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("电话号码请填写数字");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("您的填写的邮箱不合法，请重新填写！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}
function CheckForm_reg()
{
    var realname=$("RealnameControl").value;
    var cmp=$("CMPNameControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipCodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if($("UserNameControl").value=="")
    {
        alert("请填写您的用户名");
        $("UserNameControl").focus();
        return false;
    }
    else if($("UserPasswordControl").value=="")
    {
        alert("请填写您的密码");
        $("UserPasswordControl").focus();
        return false;
    }
    else if(!isNaN(realname))
    {
        alert("姓名不能为数字或为空！");
        $("RealnameControl").focus();
        return false;
    }
     else if(isNaN($("AgeControl").value))
    {
        alert("年龄请填写数字");
        $("AgeControl").focus();
        return false;
    }
   else if(!isNaN(cmp))
    {
        alert("工作单位不能为数字或为空！");
        $("CMPNameControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("请完整填写工作单位！");
        $("CMPNameControl").focus();
        return false;
    }
    else if($("UserDutyControl").value=="")
    {
        alert("请填写您的职务");
        $("UserDutyControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("工作地址不能为数字或为空！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("请完整填写工作地址！字数最少5个");
        $("AddressControl").focus();
        return false;
    }
    else if(($("ZipCodeControl").value==""))
    {
        alert("邮政编码不能为空！");
        $("ZipCodeControl").focus();
        return false;
    }
    else if(isNaN($("ZipCodeControl").value))
    {
        alert("邮政编码请填写数字！字数最少5个");
        $("ZipCodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("电话号码不能为空！");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("电话号码请填写数字");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("您的填写的邮箱不合法，请重新填写！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}

function CheckForm_en()
{
    var realname=$("RealnameControl").value;
    var cmp=$("CmpControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipcodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if(!isNaN(realname))
    {
        alert("Name Must be completed with only words！");
        $("RealnameControl").focus();
        return false;
    }
    else if(!isNaN(cmp))
    {
        alert("Company's name must be completed with only words！");
        $("CmpControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("Please fill company's name completely！");
        $("CmpControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("Company's address must be filled without number！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("Please fill company's address completely in 5 numbers");
        $("AddressControl").focus();
        return false;
    }
    else if(isNaN(zipcode))
    {
        alert("Email code should be filled with number in 5 numbers");
        $("ZipcodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("Please fill the Tel number with numbers！");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("Please fill the Tel number with numbers！");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("You have filled a wrong email address, please re-fill！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}
function CheckForm_en_reg()
{
     var realname=$("RealnameControl").value;
    var cmp=$("CMPNameControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipCodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if($("UserNameControl").value=="")
    {
        alert("Please fill the username");
        $("UserNameControl").focus();
        return false;
    }
    else if($("UserPasswordControl").value=="")
    {
        alert("Please fill the password");
        $("UserPasswordControl").focus();
        return false;
    }
   else if(!isNaN(realname))
    {
        alert("Name Must be completed with only words！");
        $("RealnameControl").focus();
        return false;
    }
     else if(isNaN($("AgeControl").value))
    {
        alert("Please fill the Age with numbers！");
        $("AgeControl").focus();
        return false;
    }
   else if(!isNaN(cmp))
    {
        alert("Company's name must be completed with only words！");
        $("CMPNameControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("Please fill company's name completely！");
        $("CMPNameControl").focus();
        return false;
    }
    else if($("UserDutyControl").value=="")
    {
        alert("Please fill your duty！");
        $("UserDutyControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("Company's address must be filled without number！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("Please fill company's address completely in 5 numbers");
        $("AddressControl").focus();
        return false;
    }
     else if(zipcode=="")
    {
        alert("Please fill the zipcode");
        $("ZipCodeControl").focus();
        return false;
    }
   else if(isNaN(zipcode))
    {
        alert("zipcode  should be filled with number in 5 numbers");
        $("ZipCodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("Please fill the Tel number with numbers！");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("Please fill the Tel number with numbers！");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("You have filled a wrong email address, please re-fill！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}

function CheckForm_jp()
{
    var realname=$("RealnameControl").value;
    var cmp=$("CMPNameControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipcodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if(!isNaN(realname))
    {
        alert("お名前は必ず数字以外でご入力下さい！");
        $("RealnameControl").focus();
        return false;
    }
    else if(!isNaN(cmp))
    {
        alert("勤務先は必ず数字以外でご入力下さい！");
        $("CMPNameControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("勤務先の正式名称をご入力下さい！");
        $("CMPNameControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("勤務先の住所は必ず数字以外でご入力下さい！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("勤務先の住所を正しくご入力下さい！5文字以上");
        $("AddressControl").focus();
        return false;
    }
    else if(isNaN(zipcode))
    {
        alert("郵便番号は数字でご入力下さい。5桁以上");
        $("ZipcodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("電話番号は数字でご入力下さい");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("電話番号は数字でご入力下さい");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("メールアドレスをご確認のうえ、もう一度ご入力下さい！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}
function CheckForm_jp_reg()
{
    var realname=$("RealnameControl").value;
    var cmp=$("CMPNameControl").value;
    var address=$("AddressControl").value;
    var zipcode=$("ZipCodeControl").value;
    var email=$("EmailControl").value;
    var telephone=$("TelephoneControl").value;
    if($("UserNameControl").value=="")
    {
        alert("おユーザーネームをご入力下さい");
        $("UserNameControl").focus();
        return false;
    }
    else if($("UserPasswordControl").value=="")
    {
        alert("パスワードを入力下さい");
        $("UserPasswordControl").focus();
        return false;
    }
     else if(isNaN($("AgeControl").value))
    {
        alert("年齢は数字でご入力下さい！");
        $("AgeControl").focus();
        return false;
    }
   else if(!isNaN(realname))
    {
        alert("お名前は必ず数字以外でご入力下さい！");
        $("RealnameControl").focus();
        return false;
    }
    else if(!isNaN(cmp))
    {
        alert("勤務先は必ず数字以外でご入力下さい！");
        $("CMPNameControl").focus();
        return false;
    }
    else if(cmp.length<5)
    {
        alert("勤務先の正式名称をご入力下さい！");
        $("CMPNameControl").focus();
        return false;
    }
    else if($("UserDutyControl").value=="")
    {
        alert("お職務をご入力下さい！");
        $("UserDutyControl").focus();
        return false;
    }
    else if(!isNaN(address))
    {
        alert("勤務先の住所は必ず数字以外でご入力下さい！");
        $("AddressControl").focus();
        return false;
    }
    else if(address.length<5)
    {
        alert("勤務先の住所を正しくご入力下さい！5文字以上");
        $("AddressControl").focus();
        return false;
    }
     else if(zipcode=="")
    {
        alert("郵便番号は数字でご入力下さい。5桁以上");
        $("ZipCodeControl").focus();
        return false;
    }
   else if(isNaN(zipcode))
    {
        alert("郵便番号は数字でご入力下さい。5桁以上");
        $("ZipCodeControl").focus();
        return false;
    }
    else if(telephone=="")
    {
        alert("電話番号は数字でご入力下さい");
        $("TelephoneControl").focus();
        return false;
    }
    else if(isNaN(telephone))
    {
        alert("電話番号は数字でご入力下さい");
        $("TelephoneControl").focus();
        return false;
    }
    else if(email.indexOf(".")<0||email.indexOf("@")<0)
    {
        alert("メールアドレスをご確認のうえ、もう一度ご入力下さい！");
        $("EmailControl").focus();
        return false;
    }
    else
    {
        return true;
    }
}