



function searchPrompt(){
var input = prompt("To search the contents of the site, please enter your search terms:");
if(input) {
document.location = 'http://www.the-mahjong-guide.com/?s='+input;
}}

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}

function pP(){
/*Makes the browser re-parse the html, otherwise when the text-size is decreased sometimes the parent element doesn't decrease.*/
var s=document.body;
var h=s.innerHTML;
s.innerHTML='';
s.innerHTML=h;
}

function changeFontSize(boolsize){
var s = "90%"; //Small font size
var n = ""; //Normal font size
var l = "110%"; //Large font size
var cn = "fontsize"; //Cookie name
var e = document.body.style;
if (boolsize){
if (boolsize=='small') { e.fontSize = s; c=s; }
if (boolsize=='normal') { e.fontSize = n; createCookie(cn,"",-1); }
if (boolsize=='large') { e.fontSize = l; c=l; }
pP()
if(c){
createCookie(cn,c);
}} else {
var a = readCookie(cn);
if (a!="") {
e.fontSize = a;
document.getElementById('mahjongmenu').style.fontSize ="8px";
document.getElementById('mahjongdate').style.fontSize ="10px";
pP();
}}}

function addBookmark(title,url) {
        //alert('adding ' + title + ', ' + url);
        if (window.sidebar) {
            window.sidebar.addPanel(title, url,"");
        } else if( document.all ) {
            window.external.AddFavorite( url, title);
        } else if( window.opera && window.print ) {
            return true;
        }
    }


     var now = new Date();
     var hours = now.getHours();
     var minutes = now.getMinutes();
     var timeValue = "" + ((hours >12) ? hours -12 :hours)
     timeValue += ((minutes < 10) ? ":0" : ":") + minutes
     timeValue += (hours >= 12) ? " P.M." : " A.M."
     timerRunning = true;
 
 
   mydate = new Date();
   myday = mydate.getDay();
   mymonth = mydate.getMonth();
   myweekday= mydate.getDate();
   weekday= myweekday;
   myyear= mydate.getFullYear();
   year = myyear
 
   if(myday == 0)
       day = " Sunday, "   
   else if(myday == 1)
      day = " Monday, "
   else if(myday == 2)
       day = " Tuesday, "  
   else if(myday == 3)
       day = " Wednesday, "  
   else if(myday == 4)
       day = " Thursday, "
   else if(myday == 5)
       day = " Friday, "
   else if(myday == 6)
       day = " Saturday, "
   if(mymonth == 0)
        month = "January "
   else if(mymonth ==1)
        month = "February "
   else if(mymonth ==2)
       month = "March "
   else if(mymonth ==3)
       month = "April "
   else if(mymonth ==4)
        month = "May "
   else if(mymonth ==5)
        month = "June "
   else if(mymonth ==6)
        month = "July "
   else if(mymonth ==7)
       month = "August "
   else if(mymonth ==8)
      month = "September "
   else if(mymonth ==9)
      month = "October "
   else if(mymonth ==10)
      month = "November "
   else if(mymonth ==11)
      month = "December"
 
//WP-EMAIL
	function email_popup(email_url) {
		window.open(email_url, "_blank", "width=620,height=580,toolbar=0,menubar=0,location=0,resizable=0,scrollbars=1,status=0");
	}


//WP-POLLS

	if(site_url != 'http://www.the-mahjong-guide.com' || ajax_url != '/index.php') {
		var site_url = 'http://www.the-mahjong-guide.com';
		var ajax_url = '/index.php';
	}

//WP-PSR

	var ratings_image = 'stars';
	var ratings_max = '5';
	var ratings_mouseover_image = new Image();
	ratings_mouseover_image.src = site_url + '/wp-content/plugins/postratings/images/' + ratings_image + '/rating_over.gif';




