function send_to_friend(url,title)
{
	createCookie('url',url);
	createCookie('title',title);
	//url = url.replace('/','~');
	open_window(site_url+'/friend',600,400,'friend');
}

_w = null;

function open_window(path,width,height,win){
	
	w = window.screen.availWidth;
	h = window.screen.availHeight;	
	
	posL = (w-width)*.5;
	posT = (h-height)*.5;
	
	if(_w && _w.open){
		_w.close();
	}	
	
	_w = window.open(path,win,'width='+width+',height='+height+',top='+posT+',left='+posL+',menubar=0,location=0,toolbar=0,personalbar=0,status=0,scrollbars=1,allowresize=1,dependent=1,resizable=1');
	
}

/* cookies */

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 eraseCookie(name) {
	createCookie(name,"",-1);
}

function input_search(which,opt){
	if(opt=='focus'){
		if(which.value=='Search') which.value = '';
	} else {
		if(which.value=='') which.value = 'Search';
	}
}