


/*****************

******************/
// 选择跳转
function selectPageTo(selObj,page){
	eval("location='"+page+selObj.options[selObj.selectedIndex].value+"'");
}

// 页面加载完毕后执行
function addLoadEvent(func){
	var oldonload=window.onload;
	if (typeof window.onload != 'function'){
		window.onload =func;
	}else{
		window.onload=function(){
			if(oldonload){
				oldonload();
			}
			func();
		}
	}
}

//获取当前页的页面名称 不含后缀
function getThisPageName(){
	var fname=window.location.href.match(/.+\/([^?]*)/)[1];
	return fname.substring(0,fname.indexOf("."));
}
//适用于 语种切换 返回 "_"之前的字母
function getThisPageName_(){
	var fname=window.location.href.match(/.+\/([^?]*)/)[1];
	return fname.substring(0,fname.indexOf("_"));
}

//获取单个参数的值
function getOneParameter(){
	var str=document.location.href; 
	if (str.indexOf("=")>0){
		return str.substring(str.indexOf("=")+1).replace('#','');
	}else{
		return "";
	}
}

//返回页面参数  不区分大小写
function getParameter(valueName){
	try{
		var str=document.location.href;
		var a=str.split("?");
		a=a[1].split("&");
		for(var i=0;i<a.length;i++){
			var b=a[i].split("=");
			if(b[0].toUpperCase()==valueName.toUpperCase())return b[1].replace('#','');
		}
		return "";
	}catch(e){
		//alert("getParameter error : "+e);
		return "";
	}
}

function getRandom(){
	
	var str="",str_d; 
	str_d=new Date(); 
	str+=str_d.getYear(); 
	str+=str_d.getMonth(); 
	str+=str_d.getDate(); 	
	str+=str_d.getHours(); 
	str+=str_d.getMinutes(); 
	str+=str_d.getSeconds(); 
	str+=Math.floor(Math.random()*999+1); 
	return str;
}


// 返回 带文件夹 
function getDateRandom(){
	var str="",str_d; 
	str_d=new Date(); 
	str+=str_d.getYear()+"/";
	str+=str_d.getMonth()+"/";
	str+=str_d.getDate()+"/";
	str+=str_d.getYear(); 
	str+=str_d.getMonth(); 
	str+=str_d.getDate(); 	
	str+=str_d.getHours(); 
	str+=str_d.getMinutes(); 
	str+=str_d.getSeconds(); 
	str+=Math.floor(Math.random()*999+1); 
	return str;
}

// 菜单 ？


// 基本 函数 
function $(v){
    return (document.getElementById(v));
}

function $S(v){
    return ($(v).style);
}
function isset(v){
    return ((typeof(v) == 'undefined' || v.length == 0) ? false : true);
}
function agent(v){
    return (Math.max(navigator.userAgent.toLowerCase().indexOf(v), 0));
}
function XYwin(v){//返回 窗口大小
    var z = agent('msie') ? Array(document.body.scrollHeight > window.screen.height 
? document.body.scrollHeight : window.screen.height , document.body.clientWidth) : Array(window.innerHeight, window.innerWidth);
    return (isset(v) ? z[v] : z);
}

function getStyle(el,IE,FF){	// 返回style 值 支持 IE FF
	var elem=document.getElementById(el)
	return navigator.appName=="Microsoft Internet Explorer"?elem.currentStyle[IE]:document.defaultView.getComputedStyle(elem, "").getPropertyValue(FF)
}

// 类生成函数
var Class = { 
	create: function() { 
		return function() { 
			this.initialize.apply(this, arguments); 
		} 
	} 
} 

Object.extend = function(destination, source) { 
	for (var property in source) { 
		destination[property] = source[property]; 
	} 
	return destination; 
} 

// Array 添加 inArray 方法
Array.prototype.inArray = function (value) {
	var i;
	for (i=0; i < this.length; i++) { 
		if (this[i] === value) return true;
	}
	return false; 
} 
// 日期类型格式化
Date.prototype.format = function(format) {
	var o =
   {
        "M+" : this.getMonth()+1, //month
        "d+" : this.getDate(),    //day
        "h+" : this.getHours(),   //hour
        "m+" : this.getMinutes(), //minute
        "s+" : this.getSeconds(), //second
        "q+" : Math.floor((this.getMonth()+3)/3),  //quarter
        "S" : this.getMilliseconds() //millisecond
    }
    if(/(y+)/.test(format))
    format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
    for(var k in o)
    if(new RegExp("("+ k +")").test(format))
    format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
    return format;
}
getShortTime : function (timeStr){
	try{
		if(!timeStr)return;
		timeStr=timeStr.replace("-","/");
		var d=new Date(timeStr);
		return d.format('yy-MM-dd');
	}catch(e){}
}
