// Common JavaScript Functions.

// Work with cookies
function common_getCookie(c_name){
	
    if (document.cookie.length>0){ 
		c_start=document.cookie.indexOf(c_name + "=")
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1){ c_end=document.cookie.length}
			return (unescape(document.cookie.substring(c_start,c_end)))
		} 
	}
	
	return null
}

function common_expireCookie(_cookie_name){
	var cookie_date = new Date(); 
	cookie_date.setTime (cookie_date.getTime() - 1 );
	document.cookie = _cookie_name += "=; expires=" + cookie_date.toGMTString() + "; path=/";
}
	
// Work with divs
function common_showBareId(_id){
	if (document.getElementById(_id)){
		document.getElementById(_id).style.display = 'block';
		document.getElementById(_id).className = 'over';
	}
}

function common_hideBareId(_id){
	if (document.getElementById(_id)){
		document.getElementById(_id).style.display = 'none';
	}
}

// Work with form validation
function common_resetFormFields(form) {
	Form.reset(form);
	Form.focusFirstElement(form);
}



