/* PageTagMenu */
function AdvHitAdd1(id)
{
	LoadXmlHttp("/Advertise/Builder/AdvHitAdd1.aspx?id="+id);
}
function LoadPageTagMenu(){
	var menu = document.getElementById('tblPageTagMenu');
	if(menu){
		menu.style.left = '15px';
		var top = document.body.scrollTop;
		if(top > 73){
			menu.style.top = top + 5 + 'px';
		}else{
			menu.style.top = '73px';
		}
		setTimeout('LoadPageTagMenu()', 200);
	}
}
function LoadPageTable(){
	var cltwidth = document.body.clientWidth;
	var table = document.getElementsByName('tblHolder');
	if(table){
		var len = table.length;
		for(i=0; i<len; i++){
			table[i].style.width = (cltwidth - 170) + 'px';
			table[i].style.marginLeft = '155px';
		}
		if(len > 0){
			setTimeout('LoadPageTable()', 1000);
		}
	}
}
window.onload = function(){
	LoadPageTagMenu();
	//LoadPageTable();
}

/* Check upload accept file type */
function CheckUploadType(val, type){
	if(val == ''){
		return true;
	}
	var ext = val.substring(val.lastIndexOf('.')+1).toLowerCase();
	var types = type.split(',');
	for(i=0; i<types.length; i++){
		if(types[i] == ext){
			return true;
		}
	}
	
	alert('\u8bf7\u9009\u62e9\u3010'+ type +'\u3011\u6587\u4ef6\u7c7b\u578b');
	return false;
}

/* view sample data */
function ShowView(Url){
	var w = document.body.clientWidth;
	var h = document.body.clientHeight;
	var cw = w * 0.8;
	var ch = h * 0.8;
	var left = (w - cw) / 2;
	var top = (h - ch) / 2;
	var win = window.open(Url, 'View', 'left='+ left +',top='+ top +',width='+ cw +',height='+ ch +'');
	win.focus();
}

/* setup a iframe window */
function SetupIframeWindow(width, height, httpurl){
	var ifr = document.getElementById('ifrWinLayer');
	alert(ifr);
}
function ShowWinLayer(width, height, httpurl){
	/* disabled select */
	//DisableSelect(true);
	
	/* show the mask */
	ShowMaskLayer();
	
	/* load page */
	var Ifr = window.frames['ifrWinLayer'];
	Ifr.location.href = httpurl;
	
	/* config style */
	SetWinLayerPos(width, height);
}
function SetWinLayerPos(width, height){
	var Win = document.getElementById('ifrWinLayer');
	var clientWidth = document.body.clientWidth;
	var clientHeight = document.body.clientHeight;
	Win.style.width = width;
	Win.style.height = height;
	Win.style.left = (clientWidth - Win.clientWidth)/2;
	Win.style.top = (clientHeight - Win.clientHeight)/2 * 0.8 +  + document.body.scrollTop;
	Win.style.visibility = 'visible';
	Win.style.border = '1px solid #6595d6';
	Win.className = 'tblBorder';
}
function DisableSelect(b){
	var eles = document.getElementsByTagName('*');
	for(i=0; i<eles.length; i++){
		if(eles[i].tagName == 'SELECT'){
			eles[i].disabled = b;
		}
	}
}
function CancelWinLayer(){
	var Win = document.getElementById('ifrWinLayer');
	Win.style.left = '0px';
	Win.style.top = '0px';
	Win.style.width = '0px';
	Win.style.height = '0px';
	Win.style.visibility = 'hidden';
	
	//enable selector
	HideMaskLayer();
	//DisableSelect(false);
}
function ShowMaskLayer(){
	var Mask = document.getElementById('divMaskLayer');
	var clientWidth = document.body.clientWidth;
	var scrollHeight = document.body.scrollHeight;
	var clientHeight = document.body.clientHeight;
	if(scrollHeight>clientHeight)
		clientHeight=scrollHeight;
	Mask.style.left = '0px';
	Mask.style.top = '0px';
	Mask.style.width = clientWidth;
	Mask.style.height = clientHeight;
	Mask.style.visibility = 'visible';
}
function HideMaskLayer(){
	var Mask = document.getElementById('divMaskLayer');
	Mask.style.left = '0px';
	Mask.style.top = '0px';
	Mask.style.width = '0px';
	Mask.style.height = '0px';
	Mask.style.visibility = 'hidden';
}

/* show member basse information */
function ShowMemberInfo(id){
	ShowWinLayer(450, 300, '/Member/builder/MemberInfo.aspx?id='+id);
}

function ShowMemberInfoConfirm(id){
	ShowWinLayer(450, 300, '/Member/builder/MemberInfoConfirm.aspx?id='+id);
}

function ShowMemberInfo2(id){
	ShowWinLayer(450, 300, '/Member/MyOffice/MemberInfo2.aspx?id='+id);
}




/* show send message window */
function ShowMessageWindow(cBoxName, tWay){
	var c = GetCheck(cBoxName);
	if(c.length > 0){
		ShowWinLayer(450, 300, '/Message/builder/Write.aspx?id='+c +'&t='+ tWay);
	}else{
		alert('\u8bf7\u9009\u62e9\u9700\u8981\u7559\u8a00\u7684\u8bb0\u5f55');
	}
}

//ÑîÖ¾»Ô 2007-01-26
function OpenWindowSetSize(width,height,url)
{
	if(url.length > 0)
	{
		ShowWinLayer(width, height,url);
	}else{
		alert('\u8bf7\u9009\u62e9\u9700\u8981\u7559\u8a00\u7684\u4f1a\u5458');
	}

}
//ÑîÖ¾»Ô 2007-01-26
function OpenWindow(url)
{
	if(url.length > 0){
		ShowWinLayer(450,300,url);
	}else{
		alert('\u8bf7\u9009\u62e9\u9700\u8981\u7559\u8a00\u7684\u4f1a\u5458');
	}
}
function CheckSendMessage(f){
	if(f.tbMemberName.value.trim() == ''){
		alertNull('\u63a5\u6536\u4f1a\u5458');
		f.tbMemberName.focus();
		return false;
	}
	if(f.tbSubject.value.trim() == ''){
		alertNull('\u4fe1\u606f\u4e3b\u9898');
		f.tbSubject.focus();
		return false;
	}
	if(f.tbContent.value.trim() == ''){
		alertNull('\u4fe1\u606f\u5185\u5bb9');
		f.tbContent.focus();
		return false;
	}
	return true;
}

/* sure to logout */
function Sure2Logout(){
	if(confirm('\u786e\u5b9a\u9700\u8981\u9000\u51fa\u7ba1\u7406\u5e73\u53f0\u5417\uff1f')){
		window.location.href = '/Base/Builder/Logout.aspx';
	}
}

/* save order id */
function SaveOrderID(cBoxName, LinkUrl){
	var val = '';
	var ord = document.getElementsByName('OrderID');
	for(i=0; i<ord.length; i++){
		val += ord[i].value +',';
	}
	
	if(val.length > 0){
		val = val.substring(0, val.length-1);
	}
	
	var cBox = document.getElementsByName(cBoxName);
	for(i=0; i<cBox.length; i++){
		cBox[i].checked = true;
	}
	
	LinkUrl += '&OrderID='+ val;
	ListAction(cBoxName, LinkUrl);
}


function WindowModalDialog(width,height,url)
{
	if(url.length > 0)
	{
		
		window.showModalDialog(url,"","dialogHeight: "+ height +"px;dialogWidth:"+ width +"px; status:no; help:no; scroll:no");
	}
	else
	{
		alert('aaaa_ModalDialog');
		//alert('\u8bf7\u9009\u62e9\u9700\u8981\u7559\u8a00\u7684\u4f1a\u5458');
	}
}
function WindowModalDialog (url)
{
	if(url.length > 0)
	{
		window.showModalDialog(url,"","dialogHeight: "+ 300 +"px;dialogWidth:"+ 400 +"px; status:no; help:no; scroll:no");
	}
	else
	{
		lert('aaaa_ModalDialo2');
		//alert('\u8bf7\u9009\u62e9\u9700\u8981\u7559\u8a00\u7684\u4f1a\u5458');
	}
}