var url = "http://www.dressupgames.name/";
var title = "Dress Up Games";

function CreateBookmarkLink() {
	title = "Dress Up Games";
	url = "http://www.dressupgames.name/";
	if (window.sidebar) {
	window.sidebar.addPanel(title, url,"");
	} else if( window.external ) {
	window.external.AddFavorite( url, title);
	}
	else if(window.opera && window.print) {
	return true; }
}
function addToBrowserSearch(){
	try {
		xurl = url+'temp/tin1sBrowser.xml';
		window.external.AddSearchProvider(xurl);
	}catch (e) {
		alert("Báº¡n cáº§n sá»­ dá»¥ng Internet Explorer (7.0+) hoáº·c Firefox (2.0+) Ä‘á»ƒ sá»­ dá»±ng chá»©c nÄƒng nÃ y.");
	}
}
function openWindow(url) {
    var width = 600;
    var height = 400;
    var left = parseInt((screen.availWidth/2) - (width/2));
    var top = parseInt((screen.availHeight/2) - (height/2));
    var windowFeatures = "width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top + "toolbar=no,location=no,status=no,menubar=no,scrollbars=no";
    myWindow = window.open(url,"subWind",windowFeatures);
}
function trim(i){i=i.replace(/([ \t\r\n\f])*$/gi,""); return i.replace(/^([ \t\r\n\f])*/gi,"");}

function setHomePage(){
    if(document.all){
        var homepage = document.getElementById('set_domain');
        if(!homepage)
            return;
        var ishp = false;
        for(var i=0;i<ZingD.length;i++)                     /*Check homepage*/
        {
            if(homepage.isHomePage('http://www.dressupgames.name/'))
            {
                ishp = true;
                break;
            }
        }  
        if(!ishp){
            homepage.style.behavior='url(#default#homepage)';            
            homepage.setHomePage(url);                  /*Set homepage*/
        }
    }
    else
        alert('Chá»n Tools > Option > Main > Use Current Page (Alt+C) Ä‘á»ƒ Ä‘áº·t trang chá»§!');
};

$(document).ready(function(){
   $("#Partner").click(function(){
		$("#Partner").addClass('select');
		$("#AddLink").removeClass('select');
		$("#show_Partner").show(500);
		$("#show_AddLink").hide(500);
	});
	$("#AddLink").click(function(){
		$("#Partner").removeClass('select');
		$("#AddLink").addClass('select');
		$("#show_AddLink").show(500);
		$("#show_Partner").hide(500);
	});
	$("#OnlineGames").click(function(){
		$("#OnlineGames").addClass('search_s radius_top');
		$("#DownloadGames").removeClass('search_s radius_top');
		$("#show_OnlineGames").show(100);
		$("#show_DownloadGames").hide(100);
	});
	$("#DownloadGames").click(function(){
		$("#OnlineGames").removeClass('search_s radius_top');
		$("#OnlineGames").addClass('search_n radius_top');
		$("#DownloadGames").addClass('search_s radius_top');
		$("#show_OnlineGames").hide(100);
		$("#show_DownloadGames").show(100);
	});
	$("#all").click(function(){
		$("#all").attr('class','select radius_top');
		$("#Today").removeClass('select radius_top');
		$("#Week").removeClass('select radius_top');
		$("#Month").removeClass('select radius_top');
	});
	$("#Today").click(function(){
		$("#all").removeClass('select radius_top');
		$("#Today").addClass('select radius_top');
		$("#Week").removeClass('select radius_top');
		$("#Month").removeClass('select radius_top');
	});
	$("#Week").click(function(){
		$("#all").removeClass('select radius_top');
		$("#Today").removeClass('select radius_top');
		$("#Week").addClass('select radius_top');
		$("#Month").removeClass('select radius_top');
	});
	$("#Month").click(function(){
		$("#all").removeClass('select radius_top');
		$("#Today").removeClass('select radius_top');
		$("#Week").removeClass('select radius_top');
		$("#Month").addClass('select radius_top');
	});
	$("#addfrend").mousemove(function(){
		$("#show_msg").html('Please login or register to add Frend');								 
	});
	$("#addfrend").mouseout(function(){
		$("#show_msg").html('');								 
	});
	$("#compose").mousemove(function(){
		$("#show_msg").html('Please login or register to Compase');								 
	});
	$("#compose").mouseout(function(){
		$("#show_msg").html("");								 
	});
	$("#comment").mousemove(function(){
		$("#show_msg").html('Please login or register to write comment');								 
	});
	$("#comment").mouseout(function(){
		$("#show_msg").html("");								 
	});
	$("#v_comment").click(function(){
	   $("#s_comment").slideToggle(200);
	});

});
function showNewsGames(i,id){
	$("#"+id).html("Loadding ....");
	$("#"+id).html();
	$.ajax({
		type: 'POST',
		url: URL_ROOT + '/newGames.php',
		data: 'type=' +i,
		success: function(xml){
			$("#"+id).html(xml);
		}
	});
}
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
