/******************************************************************
	初始化程序
/*****************************************************************/

function ShowAndHide(idx,way) {
	
	var id = window.document.getElementById(idx);
	
	switch(way) {
		case 0 : {
		id.style.display = "none";
		break;
		}
		case 1 : {
		id.style.display = "block";
		break;
		}
		default : break;
	} //end switch()
	
} //end ShowAndHide()



/******************************************************************
	会员购物订单JS函数引用
/*****************************************************************/

function PurchaseQuantity(idx,to) {
	var id = document.getElementById(idx);
	var textvalue = id.value;
	
	switch(to) {
		case "-" : {
		textvalue--;
		break;	
		}
		case "+" : {
		textvalue++;
		break;	
		}
		default : break;
	} //end switch()
	
	textvalue = textvalue.toString();	//数值转字符
	
	if(textvalue.slice(0,1) == 0) {
			id.value = 1;
			return 0;
	}
	if(textvalue == 100) {
			id.value = 99;
			return 0;
	}
	
	id.value = textvalue;
	
} //end PurchaseQuantity()

function HighBright(idx,why) {
	
	var id = window.document.getElementById(idx);
	
	switch(why) {
		case 0 : {
		id.style.border = "1px solid #ceddea";
		break;
		}
		case 1 : {
		id.style.border = "1px solid #ff8916";
		break;
		}
		default : break;
	}
	
} //end HighBright()

/******************************************************************
	检测浏览器版本
/*****************************************************************/
var isie = true;	//是否是IE
var browser = OS();	//哪个浏览器

function OS()
{ 
//IE浏览器
    if(navigator.userAgent.indexOf("MSIE")>0) {
		isie = true;
		return 1; 
    } 
//火狐浏览器
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0) {
		isie = null;
		return 2; 
    }  
	
}  //End OS()

/******************************************************************
	获取浏览器属性
/*****************************************************************/
function Browser(estate) {
	
	switch(estate) {
		case "w" : {
		return document.body.clientWidth;	//body宽
		break;	
		}
		case "h" : {
		return document.body.clientHeight;	//body高
		break;	
		}
		default : break;
	}
} //end Browser()

/******************************************************************
	获取元素属性
/*****************************************************************/
function ObtainMes(idx) {
	
	var row = new Array();
	
	var id = document.getElementById(idx);
	
	var t,l,w,h;
	if(isie == true) {
		//支持IE
		t = id.currentStyle.top;
		l = id.currentStyle.left;
		w = id.currentStyle.width;
		h = id.currentStyle.height;
		} else if(isie == null) {
		//支持FireFox
		t = window.getComputedStyle(id,null).top;
		l = window.getComputedStyle(id,null).left;
		w = window.getComputedStyle(id,null).width;
		h = window.getComputedStyle(id,null).height;
		}
		
		row[0] = parseInt(t);
		row[1] = parseInt(l);
		row[2] = parseInt(w);
		row[3] = parseInt(h);
		
		return row;
		
} //end ObtainMes()


/******************************************************************
	获取元素属性
/*****************************************************************/

function AllShowAndHide(idx,why) {
	
	var id = window.document.getElementById(idx);
	
	if(why == 0) {
		id.style.display = "none";
	} else {
		id.style.display = "block";
	}
	
} // end AllShowAndHide()
