// JavaScript Document
//window.onerror = function(){return true;}

function $(o){return document.getElementById(o);}

	
function addBookmark(title, url)
{
	if(document.all) {
		window.external.AddFavorite(url, title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
	} else if(window.opera && window.print) {
		return true;
	}
}

function onlyIntNum()
{ 
	if(!(event.keyCode==46)&&!(event.keyCode==8)&&!(event.keyCode==37)&&!(event.keyCode==39))
	if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105))) 
	event.returnValue=false; 
} 

var copyToGameClipboard=function(L){try{if(window.clipboardData){window.clipboardData.setData("Text",L);alert("复制成功，粘贴代码至游戏的聊天窗口或记事本，就可以显示出来啦。");}else{var J=document.getElementById("flashCopier");if(!J){J=document.createElement("div");J.id="flashCopier";J.style.width="0px";J.style.height="0px";J.style.visibility="hidden";document.body.appendChild(J)}J.innerHTML="";var I=[];I.push('<embed type="application/x-shockwave-flash" width="0" height="0"');I.push('src="swf/clipboard.swf" FlashVars="clipboard=');I.push(encodeURIComponent(L));I.push('"></embed>');J.innerHTML=I.join("");alert("复制成功，粘贴代码至游戏的聊天窗口或记事本，就可以显示出来啦。");}}catch(K){}};

var copyToClipboard=function(L){try{if(window.clipboardData){window.clipboardData.setData("Text",L);alert("复制成功，你现在可以粘贴(Ctrl+V)了，推荐给你的好友吧。");}else{var J=document.getElementById("flashCopier");if(!J){J=document.createElement("div");J.id="flashCopier";J.style.width="0px";J.style.height="0px";J.style.visibility="hidden";document.body.appendChild(J)}J.innerHTML="";var I=[];I.push('<embed type="application/x-shockwave-flash" width="0" height="0"');I.push('src="swf/clipboard.swf" FlashVars="clipboard=');I.push(encodeURIComponent(L));I.push('"></embed>');J.innerHTML=I.join("");alert("复制成功，你现在可以粘贴(Ctrl+V)了，推荐给你的好友吧。");}}catch(K){}};

function swap(id)
{
	for(i=1; i<=10; i++){
		if($('card_' + i)){
			$('card_' + i).className = 'itemcard2';
			$('card__' + i).style.display = 'none';
			//alert(i);
		}
		if($('card_' + id))$('card_' + id).className = 'itemcard';
		if($('card_' + id))$('card__' + id).style.display = '';
	}
}

function setpage(replaceObj,page,query){
	var url = 'pdata.php?o=' + replaceObj + '&p=' + page + '&q=' + query;
	//alert(url);
	var xmlHttp = getXmlHttpObject();
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = function()
	{
	//$('card__1').innerHTML = '<span style="color:#333333;"><br>Loading......</span>';
	
	if (xmlHttp.readyState == 4)
	{
		if (xmlHttp.status == 200)
		{
			//alert(xmlHttp.responseText);
			document.getElementById(replaceObj).innerHTML = xmlHttp.responseText;
			//cache.push(new Array(urlPath, xmlHttp.responseText));
		}
	}
	};
	xmlHttp.send(null);
}