function showPic(img){
   var div =  document.getElementById("fullImage");
   div.innerHTML  = "<div style=\"margin:20px;font-size:18px;color:#CBCBCB\">Loading...</div>";
   div.innerHTML += "<div id=\"tempDiv\" style=\"display:none\"><img src=\""+img+"\" onload=\"javascript:document.getElementById('fullImage').innerHTML='<img src="+img+" >'\"></div>";
} 


function showWindow(url,width,height){ 
  sDesrc = "width=" + width + ", height=" + height +
  		", status=no, toolbar=no, menubar=no, scrollbars=no";
  win=window.open(url, "displayWindow", sDesrc);
} 



function Rate(t,id,rate){
  var ref = encodeURIComponent(window.location.href);
  window.location.href='/rate.php?t='+t+'&id='+id+'&r='+rate+'&ref='+ref;
}


function hiliteRate(id,r){
    for(i=1;i<=r;i++){
        t_id = id+i; 
        document.getElementById(t_id).style.backgroundImage = 'url('+ blue_star.src +')';//'url(/images/stars/sblue.gif)';
    }
}

function removeHilite(id,r){
    for(i=1;i<=5;i++){
      t_id = id+i; 
      document.getElementById(t_id).style.backgroundImage = 'none';
    }
}


function writeCookie(cookieName, cookieContent, cookieExpireTime){
  var cookiePath = '/';
  if(cookieExpireTime>0){
    var expDate=new Date()
    expDate.setTime(expDate.getTime()+cookieExpireTime*1000*60*60)
    var expires=expDate.toGMTString()
    document.cookie=cookieName+"="+escape(cookieContent)+";path="+escape(cookiePath)+";expires="+expires+";";
  }
  else{
    document.cookie=cookieName+"="+escape(cookieContent)+";path="+escape(cookiePath)+";";
  } 
}

function readCookie(cookieName){
  var ourCookie=document.cookie;
  if(!ourCookie || ourCookie=="")return ""
  ourCookie=ourCookie.split(";")
  var i=0;
  var Cookie;
  while(i<ourCookie.length){
    Cookie=ourCookie[i].split("=")[0];
    if(Cookie.charAt(0)==" ")
    Cookie=Cookie.substring(1);
    if(Cookie==cookieName){
      return unescape(ourCookie[i].split("=")[1])
    }
    i++;
  }
  return '';
}

function deleteCookie(cookieName){
  var cookiePath = '/';
  document.cookie=cookieName+"="+readCookie(cookieName)+";path="+escape(cookiePath)+";expires=Thu, 01-Jan-1970 00:00:01 GMT;";
}



function SaveGeo(){
 deleteCookie("geo");
 if(document.getElementById('geo').checked)
   writeCookie('geo',"1", 77777);
 else
   writeCookie('geo',"0", 77777);
}

