﻿(function(){
	if(window!=parent) {
		alert("Warning! The Iframe of behavior is invalid!");
		document.location="index.html";
	}
})()
function $(){
	var arIDS=[];
	if(arguments.length==1){
		arIDS=document.getElementById(arguments[0]);		
	}else {
		for(var i=0,j=arguments.length;i<j;i++){
			arIDS.push(document.getElementById(arguments[i]));			
		}
	}
	return arIDS;	
}
function $f(){
	var arIDS=[];
	if(arguments.length==2){
		arIDS=document.forms[arguments[0]][arguments[1]];
	}else {
		for(var i=1,j=arguments.length;i<j;i++){
			arIDS.push(document.forms[arguments[0]][arguments[i]]);			
		}
	}
	return arIDS;	
}
function $fm(){
	var arIDS=[];
	if(arguments.length==1){
		arIDS=document.forms[arguments[0]];
	}else {
		for(var i=0,j=arguments.length;i<j;i++){
			arIDS.push(document.forms[arguments[i]]);			
		}
	}
	return arIDS;	
}
function $a(tag){
    if(arguments.length > 1)
        return $as.call(this, tag)[arguments[1]];
    else
        return $as.call(this, tag)[0];
}
function $as(tag){
    return this.getElementsByTagName(tag);
}
function $b(TagName){
    return document.createElement(TagName);
}
String.prototype.trim = function(){
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
Array.prototype.AddRange = function(newList){
    for(var i=0,j=newList.length; i<j ;i++){
        this.push(newList[i]);
    }
}
Array.prototype.Remove = function(obj){
    for(var i=0,j=this.length; i<j ;i++){
        if(this[i]==obj)
            return this.splice(i,1);
    }
}
Date.prototype.addYear = function(num){this.setFullYear(this.getFullYear() + num);return this;} 
Date.prototype.addMonth = function(num){this.setMonth(this.getMonth() + num);return this;} 
Date.prototype.addDay = function(num){this.setDate(this.getDate() + num);return this;} 
Date.prototype.addHour = function(num){this.setHours(this.getHours() + num);return this;} 
Date.prototype.addMinute = function(num){this.setMinutes(this.getMinutes() + num);return this;} 
Date.prototype.addSecond = function(num){this.setSeconds(this.getSeconds() + num);return this;} 
Date.prototype.addMS = function(num){this.setMilliseconds(this.getMilliseconds() + num);return this;} 
Date.prototype.addWeek = function(num){this.setDate(this.getDate() + num * 7);return this;}
Date.prototype.AddDay = function(iDay){
    return new Date(this.getTime() + iDay*24*60*60*1000);
}
Date.prototype.AddYear = function(iYear){
    return new Date(this.getTime() + iYear*365*24*60*60*1000);
}
var DomLoaded = {
	onload: [],
	args: [],
	loaded: function(){
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i](DomLoaded.args[i]);
	},
	load: function(){
		this.onload.push(arguments[0]);
		if(arguments.length > 1)this.args.push(arguments[1]);
		else this.args.push("");
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent)){
			var _timer = setInterval(function(){
				if (/loaded|complete/.test(document.readyState)){
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
	   window.onload = DomLoaded.loaded;
	}
}
function ImageLoad(){
	var pictures = [];
		if (document.images){
		for(var i=0,j=arguments.length;i<j;i++){
			var rslt = new Image();
			rslt.src = arguments[i];
			pictures.push(rslt);
		}
	}
	return pictures;
}
function SetAlpha(newObj,alp){
	if(window.ActiveXObject)newObj.style.filter = "alpha(opacity="+alp+"0)";
	else newObj.style.opacity = alp/10;
}
function ParseXml(strObj,strTagName){
	var regexp = new RegExp("<"+strTagName+".*>([\\s\\S]*)<\/"+strTagName+">","ig");
	strObj = regexp.exec(strObj);
	var arrObj = [];
	for(var i=1,j=strObj.length; i<j ;i++){
	    arrObj.push(strObj[i]);
	}
	return arrObj;
}
function ParseJson(strObj,strTagName){
	var regexp = new RegExp("<"+strTagName+".*>([\\s\\S]*)<\/"+strTagName+">","ig");
	strObj = regexp.exec(strObj);
	return strObj[1];
}
function BatchSetStyle(arrObj, styleStr, styleValue){
	for(var i=0,j=arrObj.length; i<j ;i++)
		arrObj[i].style[styleStr] = styleValue;
}
function BatchSetCssClass(CssClass){
	for(var i=0,j=this.length; i<j ;i++)
		this[i].className = CssClass;
}
function BatchBindEvent(arrObj, Event, Func){
	for(var i=0,j=arrObj.length; i<j ;i++){	
		arrObj[i][Event] = Func;
		arrObj[i]["NUM"] = i;
	}
}
function BatchBindObjectsEvent(){
	for(var i=0,j=this.length; i<j ;i++){
	    BatchDiffEvent.apply(this[i], arguments)
		this[i]["NUM"] = i;
	}
}
function BatchAddEvent(arrObj, method, Func){
	for(var i=0,j=arrObj.length; i<j ;i++)
	    addEvent.call(arrObj[i],method,Func);
}
function BatchDiffEvent(){
    for(var i=0, j=arguments.length; i<j; i++)
        this[arguments[i][0]] = arguments[i][1];
}
function BatchDiffStyle(){
    for(var i=0, j=arguments.length; i<j; i++)
        this.style[arguments[i][0]] = arguments[i][1];
}
function BatchDiffObjectEvent(){
    for(var i=0, j=this.length; i<j; i++)
        BatchDiffEvent.apply(this[i], arguments);
}
function BatchRunFun(fun){
    for(var i=0, j=this.length; i<j; i++)
        fun.call(this[i]);
}
function addEvent(method, Func){
	if(this.addEventListener){
		this.addEventListener(method, Func, false);	
	}else if(this.attachEvent){
		this.attachEvent("on" + method, Func);
	}else{
		this["on" + method] = Func;
	}
}
function ClearInputValue(){
    for(var i=0, j=this.length; i<j; i++)
        this[i].value = "";
}
function ExternalLinks() { 
    if (!document.getElementsByTagName) return; 
    var anchors = document.getElementsByTagName("a"); 
    for (var i=0, j=anchors.length;i < j; i++) { 
        var anchor = anchors[i]; 
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
            anchor.className = "external";
            anchor.target = "_blank"; 
        }else if(anchor.getAttribute("rel") == "forward"){
            anchor.target = "_blank"; 
        } 
    } 
}
function DisableButton(IsDisabled){
	var oObj = document.getElementsByTagName("input");
	for(var i=0, j=oObj.length; i<j; i++){
		if(oObj[i].type == "button" || oObj[i].type == "submit"|| oObj[i].type == "reset"){
			oObj[i].disabled = IsDisabled;
		}
	}
}
function DisabledAutoComplete(){
	for(var i=0, j=this.length; i<j; i++)
		this[i].setAttribute("autocomplete","off");
}
function CheckPitchOn(){
    if(typeof(this.length) == "undefined"){
        return this.checked;
    }else{
        for(var i=0,j=this.length;i<j;i++){
            if(this[i].checked)
                return true;
        }
        return false;
    }
}
function CheckPitchNumber(){
    var m=0;
    if(typeof(this.length) != "undefined"){
        for(var i=0,j=this.length;i<j;i++){
            if(this[i].checked)
                m++;
        }
    }
    return m;
}
function GetOptionSelectCount(){
    var Count = 0;
    for(var i=0,j=this.options.length;i<j;i++){
        if(this.options[i].selected)
           Count++ 
    }
    return Count;
}
function GetObjectsByAttribute(tagName, attrName, attrValue){
    var objs = $as.call(this, tagName);
    var newList = [];
    for(var i=0,j=objs.length;i<j;i++){
        if(objs[i][attrName] == attrValue)
            newList.push(objs[i]);
    }
    return newList;
}
function RecordToCookie(CookieName, typeName, typeValue, days){
    document.cookie = CookieName + "=" + typeName + "=" + typeValue + "; expires=" + AddDays(days) + "; path=/";
}
function AddDays(iDay){
	var now = new Date().getTime() + iDay*100*24*60*60*1000;
	return 	new Date(now).toGMTString();
}
function InitFlash(swf_width,swf_height,swf_UrlPath){
    var flashText=[];
    flashText.push('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="');
    flashText.push(swf_width);
    flashText.push('" height="');
    flashText.push(swf_height);
    flashText.push('">');
    flashText.push('<param name="movie" value="');
    flashText.push(swf_UrlPath);
    flashText.push('"><param name="quality" value="high">');
    flashText.push('<param name="menu" value="false"><param name="wmode" value="opaque">');
    flashText.push('<embed src="')
    flashText.push(swf_UrlPath);
    flashText.push('" wmode="opaque"');
    flashText.push('" width="');
    flashText.push(swf_width);
    flashText.push('" height="');
    flashText.push(swf_height);
    flashText.push('" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    flashText.push('</object>');
    document.write(flashText.join(""));
}