var addWinWidth = 0;  //新增窗口宽度
var addWinHeight = 0;  //新增窗口高度
var bodyWidth = 0;
var bodyHeight = 0;
$(function(){
	bodyWidth = document.body.clientWidth;
	bodyHeight = document.documentElement.clientHeight;
	addWinWidth = (bodyWidth/100)*80;   
	addWinHeight = (addWinWidth/16)*9;
})
/**
 * 判断浏览器类型
 */
function judgeBrowser(){
	var bro=$.browser;
    var browserType = "";
    if(bro.msie) {
    	browserType = "IE"; 
    }
    if(bro.mozilla) {
    	browserType = "Firefox";
    } 
    if(bro.safari) {
    	browserType = "Safari";
    }
    if(bro.opera) {
    	browserType = "Opera";
    }
    return browserType;
}

/**
 * 弹出窗口输入框宽度 长输入框
 */
function fixLongWidth(){ 
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return addWinWidth*0.76 - 22;        
	}else if(borwserType == "Firefox"){
		return addWinWidth*0.76 - 21;        
	}else if(borwserType == "Safari"){
		return addWinWidth*0.76 - 19;        
	}else if(borwserType == "Opera"){
		return addWinWidth*0.76;        
	}else {
		return addWinWidth*0.76;
	}
} 
           
/**
 * 弹出窗口输入框宽度 短输入框
 */
function fixShortWidth(){    
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return addWinWidth*0.284+3
	}else if(borwserType == "Firefox"){
		return addWinWidth*0.284+3      
	}else if(borwserType == "Safari"){
		return addWinWidth*0.284+3   
	}else if(borwserType == "Opera"){
		return addWinWidth*0.284+3    
	}else {
		return addWinWidth*0.284+3;            
	}
}
/**
 * 弹出窗口输入项少的，长输入框和小输入框统一确定长度标准
 * 小窗口长输入框长度
 */
function smallWinInputLong(){
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return 660*0.841;
	}else if(borwserType == "Firefox"){
		return 660*0.841;      
	}else if(borwserType == "Safari"){
		return 660*0.841;   
	}else if(borwserType == "Opera"){
		return 660*0.841;   
	}else {
		return 660*0.841;            
	}
}
/**
 * 小窗口短输入框长度
 */
function smallWinInputShort(){
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return 660*0.841;
	}else if(borwserType == "Firefox"){
		return 660*0.841;     
	}else if(borwserType == "Safari"){
		return 660*0.841;
	}else if(borwserType == "Opera"){
		return 660*0.841;    
	}else {
		return 660*0.336;            
	}
}

/**
 * 弹出窗口输入项少的，长输入框和小输入框统一确定长度标准
 * 小窗口长输入框长度
 */
function smallWinInputLong2(){
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return 836*0.95;
	}else if(borwserType == "Firefox"){
		return 836*0.95;      
	}else if(borwserType == "Safari"){
		return 836*0.95;   
	}else if(borwserType == "Opera"){
		return 836*0.95;   
	}else {
		return 660*0.95;            
	}
}
/**
 * 小窗口短输入框长度
 */
function smallWinInputShort2(){
	var borwserType = judgeBrowser();
	if(borwserType == "IE"){
		return 836*0.336;
	}else if(borwserType == "Firefox"){
		return 836*0.336;     
	}else if(borwserType == "Safari"){
		return 836*0.336;
	}else if(borwserType == "Opera"){
		return 836*0.336;    
	}else {
		return 836*0.282;            
	}
}

//js时间戳格式化成日期格式
function timestampformat(timestamp) {
	var date = new Date(timestamp);
	var year = date.getFullYear();
	var month = date.getMonth()+1;
	var day = date.getDate();
	return year+"-"+month+"-"+day;
}