﻿var ccc="/Main/ChangeLanguage.aspx";
function delithis(divSubContent,style)
{
	divSubContent.style.border=style;
}
function hitthis(divSubContent,style)
{
    
	divSubContent.style.border=style;
}
function delithis2(divSubContent,style)
{
	divSubContent.style.borderWidth=style;
}
function hitthis2(divSubContent,style)
{
	divSubContent.style.borderWidth=style;
}
function displaySubMenu(li) 
{
	var subMenu = li.getElementsByTagName("ul")[0];
	subMenu.style.display = "block";
	subMenu.style.zindex=2;		
	li.style.background="#c5dbf2";
	li.style.borderLeft="0px";
	li.style.borderTop="1px solid #ffffff";
	li.style.borderRight="1px solid #ffffff";
	li.style.borderBottom="1px solid";
}
function hideSubMenu(li) 
{
	var subMenu = li.getElementsByTagName("ul")[0];
	subMenu.style.display = "none";
	subMenu.style.zindex=2;
	li.style.background="none";
	li.style.border="0px";		
}
function SendCurrentStyle(style)
{
    CreateXmlHttp();
    xmlhttp.onreadystatechange=OnReceiveStyleResult;
    xmlhttp.open("post", "/Main/ChangeStyle.aspx", true);
    xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttp.send("newstyle="+style);
}
function OnReceiveStyleResult()
{//do nothing
}
function SetStyle(index,cssStyle)
{
    var c=document.getElementById(cssStyle);
    if(c.href.indexOf("/")!=-1)
    {
        var m=c.href.lastIndexOf("/");
        var n=c.href.lastIndexOf(".");
        var color=c.href.substring(1+m,n);
        switch(index)
        {
            case 0://blue
                c.href=c.href.replace(color,"blue");
                SendCurrentStyle("blue");
                break;
            case 1://green
                c.href=c.href.replace(color,"green");
                SendCurrentStyle("green");
                break;
            case 2://red
                c.href=c.href.replace(color,"red");
                SendCurrentStyle("red");
                break;
            case 3://orange
                c.href=c.href.replace(color,"orange");
                SendCurrentStyle("orange");
                break;
        }
    }
    else
    {
        switch(index)
        {
            case 0://blue
                c.href="css/blue.css";
                break;
            case 1://green
                c.href="css/green.css";
                break;
            case 2://red
                c.href="css/red.css";
                break;
            case 3://orange
                c.href="css/orange.css";
                break;
        }
    }
}
function SetLanguage(index)
{
    var hl=document.URL
    var newln="ch";
    switch(index)
    {
        case 0://
            newln="ch";
            break;
        case 1://
            newln="big5";
            break;
        case 2://
            newln="en";
            break;
    }
    window.location.href=ccc+"?url="+hl+"&newln="+newln;
    return;
}

var c=0;
function init(ulanguage)
{
switch(ulanguage)
{
    case "ch":
        c=0;
        break;
    case "en":
        c=1;
        break;
    case "big5":
        c=2;
        break;
    default:
        alert("Error!")
        break;
}
}

var xmlhttp;
function CreateXmlHttp()
{
    try
    {
	    xmlhttp=new XMLHttpRequest();
    }
    catch(e)
    {
	    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
}
function AjaxSend(ajaxurl,param)
{
    CreateXmlHttp();
    xmlhttp.onreadystatechange=OnReceiveT;
    xmlhttp.open("post", ajaxurl, true);
    xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttp.send(param);
}
function AjaxSend_S(ajaxurl,param)
{
    CreateXmlHttp();
    xmlhttp.onreadystatechange=OnReceiveT_S;
    xmlhttp.open("post", ajaxurl, true);
    xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xmlhttp.send(param);
}
function OnReceiveT()
{
    if (4==xmlhttp.readyState)
    {
        if (200==xmlhttp.status)
        {
            var Result=xmlhttp.responseText;
            OnReceived(Result);
        }
        else
        {
            alert("error,xmlhttp.status:"+xmlhttp.status);
        }
    }
}

function ShowUrl(url,target)
{
    if(undefined==target || null==target || ""==target)
    {
        target="_blank";
    }
    window.open(url,target);
}


function IsInstallQQ()
{
	try
	{
		var xmlhttp=new ActiveXObject("TimwpDll.TimwpCheck");
		return true;
	}
	catch(e)
	{
		return false;
	}
	return false;
}
function LoadQQ(qq,webSiteName,webUrl)
{
    var boolFals=IsInstallQQ();
    if(boolFals==true)
    { 
        if(undefined==qq || null==qq || ""==qq) qq="58310635";
        if(undefined==webSiteName || null==webSiteName || ""==webSiteName) webSiteName="秋硕";
        if(undefined==webUrl || null== webUrl || ""==webUrl) webUrl="http://www.qiushuo.net";
        location.href="Tencent://Message/?menu=yes&exe=&uin="+qq+"&websiteName="+webSiteName+"，"+webUrl+"&info=";
    }
    else
    {
        location.href='http://is.qq.com/webpresence/up_alarm.shtml';
    }
}