﻿/*
$################{ Developed By inetstar }#################$
*                                                          *
* http://www.inetstar.net                                  *
*                                                          *
* This Site Use C# for .Net Framework 2.0 Developed        *
* Service For www.simplegreenchina.com                     *
*                                                          *
* QQ:1252094                                               *
* Email:tnt2email@163.com                                  *
*                                                          *
$################{ Developed By inetstar }#################$
*/

var imgAlt = "";

function Anthem_Error(result){
    //MsgAlert("异步处理时发生错误！\n" + result.error);
    MsgAlert("异步处理时发生错误！");
}

function MsgAlert(message,redirect,url){
    window.alert("系统信息：" + message);
    if (redirect == 1){
        history.go(-1);
    }
    else if(redirect == 2){
        window.location.href = url;
    }
}

function MsgConfirm(message,yesurl,nourl){
    if (confirm("系统信息：" + message)){
        window.location.href = yesurl;
    }
    else{
        window.location.href = nourl;
    }
}

function ShowLoading(){
    $("input[@type=submit]").hide();
    $("img[@alt=Loading...]").show();
}

function HideLoading(){
    $("input[@type=submit]").show();
    $("img[@alt=Loading...]").hide();
}

function autoSize(img,width,height,type){
	try
	{
		var image = new Image();
		image.src = img.src;
		
		if (type == 0){
			img.width = image.width > width ? width : image.width;
			img.height = image.height > height ? height : image.height;
		}
		else{
			if (image.width > width || image.height > height){
				var wsize = image.width / width;
				var hsize = image.height / height;
				
				if (wsize > hsize){
					img.width = width;
					img.height = image.height / wsize;
				}
				else{
					img.width = image.width / hsize;
					img.height = height;
				}
			}
		}
	}
	catch(e) { }
}

function setImage(img){
    if (img.alt != imgAlt){
        imgAlt = img.alt;
        $(".SiteClass img").each(function(){
            this.src = "images/Menu/" + this.alt + ".gif";
        });
        img.src = "images/Menu/" + img.alt + "_.gif";
        $(".PageList div").hide();
    }
}

function showMenu(img,className,padding){
    if (img.alt != imgAlt){
        imgAlt = img.alt;
        $(".SiteClass img").each(function(){
            this.src = "images/Menu/" + this.alt + ".gif";
        });
        img.src = "images/Menu/" + img.alt + "_.gif";
        $(".PageList div").hide();
        $(".PageList").css("padding-left",padding);
        $(".PageList ." + className).fadeIn("normal");
    }
}
