function recalc_pr(ap, cp)
{
	var	a	=	document.forms[0].adults.value;
	var	c	=	document.forms[0].children.value;

	var	tot	=	(a*ap)+(c*cp);

	var pr	=	document.getElementById('bval');
	
	pr.innerHTML	=	tot;
}

function recalc_h()
{
	var	f	=	document.forms[0];
	var	tot	=	0;
	for(var i=0;i<f.length;i++)
		tot=tot+1;

	var pr	=	document.getElementById('bval');
	
	pr.innerHTML	=	tot;
}

function ch_status(bid, stid)
{
	action('status');
	document.forms[0].book_id.value	=	bid;
	document.forms[0].status_id.value	=	stid;
	document.forms[0].submit();
}

function action(act)
{
	document.forms[0].action.value	=	act;
}

function sh(id)
{
	document.all[id].style.display=document.all[id].style.display=='block'?'none':'block';
}

var addthis_config =
	{ 
		services_expanded:'twitter,facebook,livejournal'
	}

function ctags(name)
{
	if (document.forms[0].tags.value.indexOf(name)>=0)
	{
		document.forms[0].tags.value = (', '+document.forms[0].tags.value).replace(', '+name, '');
		if (document.forms[0].tags.value.indexOf(', ')==0)
			document.forms[0].tags.value = document.forms[0].tags.value.substring(2);
	}
	else
	document.forms[0].tags.value=document.forms[0].tags.value+(document.forms[0].tags.value?", ":'')+name;
}

function arm(id, rm)
{
	var gt	=	document.forms[0].geotypes.value.length>1?document.forms[0].geotypes.value.split(','):[];
		
		if (rm)
		{
		for(i=0;i<gt.length;i++)
			if (gt[i]==id)
				gt.splice(i, 1);
		}
		else
			gt[gt.length]=id;

		gt.sort();

	document.forms[0].geotypes.value= gt.join(',');
}

function	enablexbed(name)
{
	//alert(document.all[name]);
	if (document.all[name])
	{
		if (!document.all[name].disabled)
			document.all[name].checked = false;
		
		document.all[name].disabled = !document.all[name].disabled;
	}
}

	function sendit(pid, pqid)
	{
		document.location.href= 'poll.php?pq='+pqid+'#pll'+pid;
	}

function createRequestObject()
{
	if (window.XMLHttpRequest) {
		try {
			return new XMLHttpRequest();
		} catch (e){}
	} else if (window.ActiveXObject) {
		try {
			return new ActiveXObject('Msxml2.XMLHTTP');
		} catch (e){
		  try {
			  return new ActiveXObject('Microsoft.XMLHTTP');
		  } catch (e){}
		}
	}
	return null;
}



function showhide(name, bi)
{
	bi=bi==null?'block':bi;
	d	=	document.getElementById(name);
	d.style.display=d.style.display=='none'||d.style.display==''?bi:'none';
}	




