//// Client side interactive cookie Flagging script
//// Writen by samuel odofin 2006.
////Call on me at anytime samuelodofin[at]yahoo[dot]com
//// Compactible with tipue search 2.1

function seCook(){
if(navigator.cookieEnabled == '0'){
alert('you need to enable your cookies before you can use any of the star and researcher features');
}else{
setCookie('justdoit',pose,360,'/')
}
}

function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}
function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

//this i put to let users flush their starred pages, when they are tired of seeing them :)lol
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

var link = location.href;
var title = document.title;
var rup = link + "^" + title;
var bless = getCookie("starred");
if (bless == null){
var realval = rup;
}else{
var realval = bless + "," + rup;
}

function justdoit(){
var bles = getCookie("justdoit");
var pose = "yes";
if (bles == pose || bles == null){
setCookie('starred',realval,360,'/')
window.alert('Flagging was succesful');
}else{
setCookie('starred',realval,360,'/')
window.alert('Flagging was succesful');
}
}

function addstar(url,title){
var rup = url + "^" + title;
var bless = getCookie("starred");
if (bless == null){
var realval = rup;
}else{
var realval = bless + "," + rup;
}
var bles = getCookie("justdoit");
var pose = "yes";
if (bles == pose || bles == null){
setCookie('starred',realval,360,'/')
window.alert('Flagging was succesful');
}else{
setCookie('starred',realval,360,'/')
window.alert('Flagging was succesful');
}
}

function setit(){
var ese = document.pref.auto.value;
var pose = "yes";
var npose = "no";
if (ese == pose){
setCookie('justdoit',pose,360,'/')
window.alert('Your preference has being set. Pages will now automatically reload when starred');
}else if(ese == npose){
setCookie('justdoit',npose,360,'/')
window.alert('Your preference has being set. Pages will not automatically reload when starred');
}else{
}
}


function setlang(){
var ese = document.langpref.auto.value;
var pose = "en";
var npose = "ch";
if(document.langpref.name.checked){
var es = "default"
}else{
var es = "anything"
}
if (ese == pose){
var alrt = "English(uk)";
setCookie('justdoitl',pose,360,'/')
window.alert('Your preference has being set ' + alrt + ' Version will now load');
}else if(ese == npose){
var alrt = "Traditional Chinesse";
setCookie('justdoitl',ese,360,'/')
window.alert('Your preference has being set ' + alrt + es + ' Version will now load');
}else{
}
}