﻿String.prototype.Trim 	= function(){return this.replace(/^\s+|\s+$/g,"");}
String.prototype.Ltrim	= function(){return this.replace(/^\s+/g, "");}
String.prototype.Rtrim	= function(){return this.replace(/\s+$/g, "");}
String.prototype.LtrimN	= function(){return this.replace(/(&nbsp;)*/, "");}
String.prototype.StripHTML = function(){return this.replace(/<([^>]+)>/g,""); }

function Checkdo(megstr){
	if(!confirm(megstr)){return false;}
}
	
function CheckDele(){
	if(!confirm('确定删除记录?')){return false;}
}

function ShowDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){
		var arr = obj.split(",");
		var str = str.split("*");
		if(arr.length > 1){
			for(i = 0; i < arr.length; i++){
				eval(arr[i]).value = str[i];
			}
		}else{			
			eval(obj).value = str;
		}
	}
}

function ShowQuickUploadDialog(obj,url,width,height){
	var str=showModalDialog(url,window,"dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:auto;resizable:no;status:no");
	if (str != undefined){	
		var oEditor = FCKeditorAPI.GetInstance(obj) ;
		if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
		{
			oEditor.InsertHtml(str) ;
		}
		else
		{
			alert( 'You must be on WYSIWYG mode!' ) ;
		}	
	}
}

function Fjump(value)
{
	if(value!= '') {
		window.location=('?s='+value);
	}
}

function Forumjump(value)
{

	if(value!= 0) {
		window.location=value;
	}
}


function KFjump(value)
{
	if(value!= 0) {
		window.location="?s=product&kf="+value;
	}else{
		window.location="?s=product";
	}
}

function KFTjump(value)
{
	if(value!= 0) {
		window.location="?s=trade&kf="+value;
	}else{
		window.location="?s=trade";
	}
}

/***************客户端***************/
/**反选*/
function CheckOthers(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];

			if (e.checked==false)
			{
				e.checked = true;
			}
			else
			{
				e.checked = false;
			}
	}
}
/**全选*/
function CheckAll(form)
{
	for (var i=0;i<form.elements.length;i++)
	{
		var e = form.elements[i];
			e.checked = true;
	}
}

function doButton(ac){
	List.action = "/cfc/admin/article.cfc?method=selectCommand&value="+ac; 
	List.submit();
} 

function getIE(e,type){
  var t=e.offsetTop;
  var l=e.offsetLeft;
  while(e=e.offsetParent){
    t+=e.offsetTop;
    l+=e.offsetLeft;
    }
	
	if(type == 1){
		return t;	
	}else{
		return l;	
	}
  	
  }

function Show_ProductCateList(FormName,FileName)
{
	if(document.getElementById("ProductCateList").style.visibility == "hidden")
	{
		document.getElementById("ProductCateList").style.visibility="visible";
	}
		
	document.getElementById("ProductCateList").style.left = getIE(document.getElementById("selectgame"),0);
	document.getElementById("ProductCateList").style.top = getIE(document.getElementById("selectgame"),1)+20;
	
	window.document.frames["PCList"].location= FileName;	


}

function Close_ProductCateList()
{	
	document.getElementById("ProductCateList").style.visibility="hidden";
}