
/* ------------------- shanX ----------------- */


function tools_w(url,width,height){
 options="toolbar=no,scrollbars=yes,directories=no,status=yes,menubar=no,";
 options+="resizable=yes,width="+width+",height="+height;
 window.open(url,"tools", options);
}

function prt_w(x){
 tools_w(x+'.print',700,500);
}

function pdf_w(x){
 x=x.replace('.html','');
 tools_w(x+'.pdf',800,600);
}

function set_voted(x){
 dat=rcookie('rated_clips');
 val='';
 if(dat!='')val+=dat;
 val+=' '+x;
 wcookie('rated_clips',val,30);
}

function wcookie(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 rcookie(x){
 var theCookie=document.cookie;
 var ind=theCookie.indexOf(x);
 if (ind==-1 ||x=="") return ""; 
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length; 
 return unescape(theCookie.substring(ind+x.length+1,ind1));
}

function eml_w(x){
 cdat=rcookie('mailed_clips');
 crdat=cdat.split('|');
 if(crdat.length < 10)tools_w(x+'.mail',400,260);
 else alert('You have sent 10 emails today, Please send again tomorrow.');
 set_mailed(x);
}

function set_mailed(x){
 dat=rcookie('mailed_clips');
 val=x;
 if(dat!='')val+='|'+dat;
 else val=x;
 wcookie('mailed_clips',val,30);
}
