function open_win(href, width, height, name) {
	if (!name) name = '_blank';
	var Win = window.open(href, name, 'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,toolbar=no,menubar=yes,left=20,top=20');
}

function open_win2(href, width, height, name) {
	if (!name) name = '_blank';
	var Win = window.open(href, name, 'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,toolbar=no,menubar=no,left=20,top=20');
}

function printpage() {
  window.print();  
}

/* 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);
}

/* /cookies */

function show_form_part ( part_id ) {
	//alert(document.getElementById(part_id).style.display);
	createCookie(part_id, 'show', 365);
	document.getElementById(part_id).style.display = "block";
}

function hide_form_part ( part_id ) {
	//alert(document.getElementById(part_id).style.display);
	createCookie(part_id, 'hide', 365);
	document.getElementById(part_id).style.display = "none";
}

var partsSwitchArray = new Array();
function switch_form_part ( part_id, index ) {

	partsSwitchArray[index] = readCookie(part_id);

	if (partsSwitchArray[index] == 'show')	{
		partsSwitchArray[index] = 'hide'; 
		hide_form_part ( part_id );
	}
	else {
		partsSwitchArray[index] = 'show'; 
		show_form_part ( part_id );
	}

}
