var input = {
	login: function(el) {
		if (el.value == "Your Login") el.value = "";
		el.onblur = function() {
			if (el.value == "") el.value = "Your Login";
		}
	}
}
var Embed = {

Flash: function(strFlashUrl, n4Witdh, n4Height, strWmode, strId, strClassName, strFlashvar) {

		if (n4Witdh != 0) {	   
			objSize_attribute = " width='" + n4Witdh + "' height='" + n4Height + "'";
		} else {
			objSize_attribute = "";
		}

		if (strId != 0) {
			objId_attribute = " id='" + strId + "'";
			objId_IE_attribute = " id='" + strId + "'";
		} else {
			objId_attribute = "";
			objId_IE_attribute = "";
		}

		if (strClassName != 0) {
			className_attribute = " class='" + strClassName + "'";
		} else {
			className_attribute = "";
		}

		if (strWmode != 0) {
			wmode_param = "<param name='wmode' value='" + strWmode + "' >";
			wmode_attribute = " wmode='" + strWmode + "'";
		} else {
			wmode_param = "";
			wmode_attribute = "";
		}

		if (strFlashvar != 0) {
			Flashvar_param = "<param name='flashvars' value='" + strFlashvar + "' >";
			Flashvar_attribute = " Flashvars='" + strFlashvar + "'";
		} else {
			Flashvar_param = "";
			Flashvar_attribute = "";
		}

		document.writeln("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' " + objSize_attribute + objId_IE_attribute + className_attribute + ">");
		document.writeln("<param name='movie' value='" + strFlashUrl + "' >");
		document.writeln("<param name='quality' value='high' >");
		document.writeln("<param name='menu' value='0' >");
		document.writeln("<param name='allowScriptAccess' value='always' >");
		document.writeln("<param name='allowFullScreen' value='true' >");
		document.writeln(wmode_param);
		document.writeln(Flashvar_param);
		document.writeln("<!-- Hixie method -->");
		document.writeln("<!--[if !IE]> <-->");
		document.writeln("<object type='application/x-shockwave-flash' allowScriptAccess='always' data='" + strFlashUrl + "'" + Flashvar_attribute + objSize_attribute + objId_attribute + wmode_attribute + className_attribute + "></object>");
		document.writeln("<!--> <![endif]-->");
		document.writeln("</object>");
	}
}
function replaceAll(str)
{
	for ( i = 0; i < str.length; i++ )
	{
		str = str.replace("+","%2B"); 
		str = str.replace(" ","%20"); 
	}
	return str;
}
function confirmDelete()
{ 
	if (confirm("Are you sure in your choice?\n\nOK - I'm Shure\nCancel - No I don't"))
	{
		return true; 
	}
	else
	{
		return false;
	} 
}
function request(formid,divid,method,filereq)
{
	var type = confirmDelete();
	if (type == true)
	{
	var XMLHttpRequestObject = false;
		if(window.XMLHttpRequest){
			XMLHttpRequestObject=new XMLHttpRequest();
			if(XMLHttpRequestObject.overrideMimeType){
				XMLHttpRequestObject.overrideMimeType('text/xml');
			}
		} else if(window.ActiveXObject){
			try{
				XMLHttpRequestObject=new ActiveXObject("Msxml2.XMLHTTP");
			} catch(e) {
				try{
					XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
				} catch(e){
				}
			}
		}
		if(!XMLHttpRequestObject) {
			alert('Your Browser don\'t support Ajax!');
			return false;
		}
		XMLHttpRequestObject.onreadystatechange = function() {
			if (XMLHttpRequestObject.readyState==4) {
				if (document.getElementById(divid))
				{
					if (divid != "") document.getElementById(divid).innerHTML = XMLHttpRequestObject.responseText;
					if (document.getElementById("refreshpage"))
					{
						$.historyLoad(replaceAll(escape(document.getElementById("refreshpage").value)));
						return false;
					}
					if (document.getElementById("refreshpage2"))
					{
						window.location = document.getElementById("refreshpage2").value;
						return false;
					}
					if (document.getElementById("dotitle")) document.title=document.getElementById("dotitle").value;
					if (document.getElementById("module_contet")) document.getElementById("h4").innerHTML=document.getElementById("module_contet").value;
					if (ut == 1 && document.getElementById("new_credits")) document.getElementById("ajaxcredits").innerHTML=" "+document.getElementById("new_credits").value;
					$("a[rel='history2']").click(function(){
						var hash = this.href;
						hash = replaceAll(hash);
						hash = hash.replace(/^.*?emw;/, '');
						$.historyLoad(hash);
						return false;
					});
					nd();
					$("a[rel='action']").click(function(){
						var getsrol = this.href;
						getsrol = getsrol.replace(/^.*?emw;/, '');
						jQuery.scrollTo( '#'+getsrol, 1000);
						return false;
					});
				}
			}
		}
		XMLHttpRequestObject.open(method,rootfolder+filereq, true);
		if (method == 'POST')
		{
			self.form = document.getElementById(formid);
			var senddata = formData2QueryString(self.form);
			senddata = replaceAll(senddata);
			XMLHttpRequestObject.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
			XMLHttpRequestObject.send(senddata);
		}
		else
		{
			http_request.send(null);
		}
	}
}
function updateajaxresults(url,div,timeoutt,send){
	var xmlhttp = false;
	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');
		}
	} else if(window.ActiveXObject){
		try{
			xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try{
				xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e){
			}
		}
	}
	if(!xmlhttp) {
		alert('Your Browser don\'t support Ajax!');
		return false;
	}
	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState==4) {
		if (div	!=	"")
		{
			document.getElementById(div).innerHTML = xmlhttp.responseText;
			if (document.getElementById("refreshpage")) window.location = document.getElementById("refreshpage").value;
			if (timeoutt	!=	"")	timeout	=	setTimeout("updateajaxresults('"+url+"','"+div+"','"+timeoutt+"','"+send+"');",	timeoutt);
			}
		}
	}
	xmlhttp.open('POST',rootfolder+url);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
	xmlhttp.send(send);
}
function updateresults(){
	timeout	=	setTimeout("updateajaxresults('getpage.php?cat=Top-10','ajaxtop10','60000','up=1');updateajaxresults('getpage.php?cat=ServerInfo','attacklist','60000','up=1');updateajaxresults('getpage.php?cat=GameServer','gameservers','60000','up=1');updateajaxresults('getpage.php?cat=OnWebUsers','right_bottomm','60000','up=1');",	60000);
	if (ut == 1) 	timeout	=	setTimeout("updateajaxresults('getpage.php?cat=GetFPM','get_pm_fr','60000','up=1');",	60000);

}
function search_()
{
	if (document.getElementById("txtWord").value != "" && document.getElementById("t").value != "")
	{
		$.historyLoad("Search;"+document.getElementById("t").value+";"+replaceAll(escape(document.getElementById("txtWord").value)));
		document.getElementById("txtWord").value="";
	}
	else
	{
		alert("Please enter a value!");
	}
}
function show_hide(id){
	if (document.getElementById(id).style.display == "none")
	{
		$('#'+id).slideDown(500);
	}
	else
	{
		$('#'+id).slideUp(500);
	}
}
function fnGoClientDownload()
{
	document.location.href = "#Download";
}
function getcolors()	{
	if (document.getElementById("chatcolors").innerHTML !=	"")
	{
		return false;
	}
	var	r	=	0,	g	=	0,	b	=	0;
	var	numberList	=	new	Array(6);
	var	color		=	'';
	var	dir			=	'h';
	var table		=	'';
	var	width		=	'12';
	var	height		=	'10';
	numberList[0]	=	'00';
	numberList[1]	=	'40';
	numberList[2]	=	'80';
	numberList[3]	=	'BF';
	numberList[4]	=	'FF';
	table +='<table class="type2" cellpadding="0" cellspacing="1">';
	for	(r	=	0;	r	<	5;	r++)
	{
		if	(dir	==	'h')
		{
			table +='<tr>';
		}
		for	(g	=	0;	g	<	5;	g++)
		{
			if	(dir	==	'v')
			{
				table +='<tr>';
			}
			for	(b	=	0;	b	<	5;	b++)
			{
				color	=	String(numberList[r])	+	String(numberList[g])	+	String(numberList[b]);
				table +='<td bgcolor="#'	+	color	+	'">';
				table +='<img style="cursor:pointer;" onclick=\'document.getElementById("chatcolor").style.backgroundColor="#'+color+'"; show_hide("chatcolors"); return nd();\' src="'+rootfolder+'images/spacer.gif" width="'	+	width	+	'" height="'	+	height	+	'" alt="#'	+	color	+	'" onmouseover=\'return overlib(\"#'	+	color	+	'\");\' onmouseout=\'return nd();\'>';
				table +='</td>';
			}
			if	(dir	==	'v')
			{
				table +='</tr>';
			}
		}
		if	(dir	==	'h')
		{
			table += '</tr>';
		}
	}
	table += '</table>';
	document.getElementById("chatcolors").innerHTML=table;
}
			function pageload(hash) {
				hash = replaceAll(hash);
				$("#sh1_").slideDown(500);
				$("#sh_").slideUp(500);
				if(hash) {
					setTimeout('$("#sh_").load("getpage.php?cat='+hash+'");',500);
				} else {
					setTimeout('$("#sh_").load("getpage.php?cat='+category+'");',500);
				}
			}
$(document).ready(function() {
	if (window.location.hash == "") $("#sh_").load("getpage.php?cat="+category);
	$.historyInit(pageload, "index.php");
	$("a[rel='history']").click(function(){
		var hash = this.href;
		hash = hash.replace(/^.*?emw;/, '');
		hash = replaceAll(hash);
		$.historyLoad(hash);
		return false;
	});
	//Add PNG Fix
	$(document).pngFix();
	//select all the a tag with name equal to modal
	$('li[id=llog]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = "#dialog1";
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.6);
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(2000); 
	
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});

