var state=1;//2-mini, 1-full
cx_wphb_init();

function cx_wphb_init() {
	document.getElementById("cx_wphb_bar").style.display = "block";
	document.getElementById("cx_wphb_minibar").style.display = "none";
		
	document.getElementById("cx_wphb_minibar").style.width = "180px";
	document.getElementById("cx_wphb_minibar").style.filter = "alpha(opacity:60)";
	document.getElementById("cx_wphb_minibar").style.opacity = 0.6;
}

function cx_wphb_toggleform()
{
	if(state==1)
	{
		document.getElementById("cx_wphb_minibar").style.display = "block";
		document.getElementById("cx_wphb_bar").style.display = "none";
		
		state=2;
	}else{
		document.getElementById("cx_wphb_bar").style.display = "block";
		document.getElementById("cx_wphb_minibar").style.display = "none";
		
		state=1;
	}
	
	createCookie('cx_wpheadbar_state',state,7);
}












//http://www.quirksmode.org/js/cookies.html

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);
}





var cv=readCookie('cx_wpheadbar_state');
if(cv!=null)
{
	state=3-cv;
	cx_wpheadbar_toggleform();
}