﻿function Show_YKTab(YKTabid_num,YKTabnum){
 for(var i=0;i<2;i++){document.getElementById("YKTabCon_"+YKTabid_num+i).style.display="none";}
 for(var i=0;i<2;i++){document.getElementById("YKTabMu_"+YKTabid_num+i).className="";}
 document.getElementById("YKTabMu_"+YKTabid_num+YKTabnum).className="YKTabsOn";
 document.getElementById("YKTabCon_"+YKTabid_num+YKTabnum).style.display="block";
} 
function rndNum(n){
    var rnd="";
    for(var i=0;i<n;i++)
        rnd+=Math.floor(Math.random()*10);
    return rnd;
}
function sndReq(vote,id_num,ip_num,units) {
$('#unit_ul'+id_num).html('<div class="loading"></div>');
    var url = '/flash-games/vote.html?j='+vote+'&q='+id_num+'&t='+ip_num+'&c='+units+'&rnd='+rndNum(4);
    $.get(url, function(data){
        if(data.indexOf('|') != -1) {
                var update = data.split('|');
                $('#'+update[0]).html(update[1]);
            }
    });
}
function loadcomment(id, page){
    var url = '/flash-games/comment.html?id='+id+'&page='+page+'&rnd='+rndNum(4);
    
	$.get(url, function(data){
        $('#comment').html(data);
    });
}    
function searchbar(){
document.writeln("<div style=\"float:left\">");
document.writeln("<input name=\"radiobutton\" type=\"radio\" id=\"YKTabMu_10\" onclick=\"Show_YKTab(1,0)\" value=\"radiobutton\" checked\/>");
document.writeln(" Search Flash Games &nbsp;");
document.writeln("<input type=\"radio\" id=\"YKTabMu_11\" onclick=\"Show_YKTab(1,1);\" name=\"radiobutton\" value=\"radiobutton\"\/>   ");
document.writeln(" Search Web");
document.writeln("<\/div>");
document.writeln("<div id=\"YKTabCon_10\" style=\"float:left; margin-left:10px;\">");
document.writeln("<form id=\"form2\" name=\"form2\" method=\"get\" action=\"\/flash-games\/query.html\">           ");
document.writeln("<input name=\"k\" id=\"k\" type=\"text\" class=\"search_text\" \/>");
document.writeln("<input name=\"Submit3\" type=\"submit\" class=\"subbut\" value=\"Game Search\" \/>");
document.writeln("<\/form>");
document.writeln("<\/div>");
document.writeln("<div id=\"YKTabCon_11\" style=\"float:left;display:none; margin-left:10px;\">");
document.writeln("<!-- Search Google -->");
document.writeln("<center>");
document.writeln("<form method=\"get\" action=\"\/flash-games\/search.html\" target=\"_top\">");
document.writeln("<table bgcolor=\"#eef2b1\" cellspacing=\"0\">");
document.writeln("<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\">");
document.writeln("<label for=\"sbi\" style=\"display: none\">Enter your search terms<\/label>");
document.writeln("<input type=\"text\" name=\"q\" size=\"31\" maxlength=\"255\" value=\"\" id=\"sbi\" class=\"search_text\"><\/input>");
document.writeln("<label for=\"sbb\" style=\"display: none\">Submit search form<\/label>");
document.writeln("<input type=\"submit\" name=\"sa\" value=\"Google Search\" id=\"sbb\" class=\"subbut\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"client\" value=\"pub-3728392910557551\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"forid\" value=\"1\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"channel\" value=\"1479206946\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"ie\" value=\"UTF-8\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"oe\" value=\"UTF-8\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"flav\" value=\"0001\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"sig\" value=\"7xXL1jTCosmu0Xff\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"cof\" value=\"GALT:#9f3e37;GL:1;DIV:#000066;VLC:000066;AH:center;BGC:FFFFFF;LBGC:000066;ALC:000066;LC:000066;T:000000;GFNT:000066;GIMP:000066;FORID:11\"><\/input>");
document.writeln("<input type=\"hidden\" name=\"hl\" value=\"en\"><\/input>");
document.writeln("<\/td><\/tr><\/table>");
document.writeln("<\/form>");
document.writeln("<\/center>");
document.writeln("<!-- Search Google -->");
document.writeln("<\/div>");
}
function addBookmark(title,url)    
{   
    if (window.sidebar) {   
        window.sidebar.addPanel(title, url, title); //Mozilla browser   
    } else if( document.all ) { //IE browser   
        window.external.AddFavorite( url, title);    
    } else if( window.opera && window.print ) { //not support Now   
        return true;   
    }   
}   
function SetHome(obj, vrl){
    try{
            obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
    }
    catch(e){
        alert("err:");
        if(window.netscape) {
            try {
                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
            } 
            catch (e) { 
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage',vrl);
         }
    }
}