function disable_enter(e){
	if(e.target)t=e.target;
	else if(e.srcElement)t=e.srcElement;
	if(t.nodeType==3)
		t = t.parentNode;
	if(e.keyCode==13&&t.tagName!="TEXTAREA"&&t.tagName!="textarea") {
		return false;
	}else{
		return true;
	}
}
function check_form(f){
	fe=false;ee=false;
	e=document.getElementsByTagName('input');
	y=0;
	for(x=0;x<e.length;x++){
		if(e[x].form.id==f.id){
			if(e[x].className=="required"&&e[x].value==""){
				if(y==0)e[x].focus();
				y++;
				fe=true;e[x].style.borderColor="#FF0000";
			}else{
				e[x].style.borderColor="";
			}
			if(e[x].title=="email"){
				if(validate_email(e[x].value)==false){
					ee=true;e[x].style.borderColor="#FF0000";
				}else{
					e[x].style.borderColor="";
				}
			}
		}
	}
	if(fe||ee){
		s="";
		if(fe){
			s="Please fill in all required fields.";
		}
		if(ee){
			s=s+" Invalid E-mail address.";
		}
		status_message(s);scroll(0,0);return false;
	} else {
		return true;
	}
}
function validate_email(a) {
	f  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return (f.test(a));
}
function checkbox(o){
	do{
		o=o.previousSibling;
	}while(o.tagName!="input"&&o.tagName!="INPUT")
	o.checked==true?o.checked=false:o.checked=true;
	return false;
}
function changeFontSize(s){
	if(document.getElementById){
		createCookie('font_size_pref',s,365);
		o = document.getElementById('font_size_'+s);
		document.getElementById('main_body').style.fontSize=s+'px';
		o.style.backgroundColor='#E0F8DC';
		p=o.parentNode;
		si=p.childNodes
		for (var i=0;i<si.length;i++){
			t=si[i].tagName;
			if((t=='div'|t=='DIV')&&si[i].id!=o.id) {
				si[i].style.backgroundColor='transparent';
			}
		}
	}
}

function createCookie(n,v,d)
{
	if (d)
	{
		var da=new Date();
		da.setTime(da.getTime()+(d*24*60*60*1000));
		var e="; expires="+da.toGMTString();
	}
	else var e="";
	document.cookie = n+"="+v+e+"; path=/";
}

function readCookie(n){
	var nEQ=n+"=";
	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(nEQ)==0) return c.substring(nEQ.length,c.length);
	}
	return null;
}

function init_font_size(){
	p=readCookie('font_size_pref');
	if(p==null){
		p=10;	
	}
	changeFontSize(p);
}

function email_page(o) {
	Effect.toggle('email_page', 'blind');
}

function submit_email_page(f) {
	et = f.to.value;
	ef = f.from.value;
	if (validate_email(et) && validate_email(ef)) {
		return true;	
	} else {
		if (validate_email(et)) {
			f.to.style.borderColor='';
		} else {
			f.to.style.borderColor='#FF0000';
		}
		if (validate_email(ef)) {
			f.from.style.borderColor='';
		} else {
			f.from.style.borderColor='#FF0000';
		}
		alert('Invalid E-mail Address');
		return false;
	}
}

function openWin(url,wth,hgt) {
	if('full' == wth){
		pwindow = window.open(url);
	} else {
		if (wth) {
			mywidth=wth;
		} else {
			mywidth=600;
		}

		if (hgt) {
			myheight=hgt;
		} else {
			myheight=400;
		}

		pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height='+myheight+',scrollbars=yes,menubar=yes,toolbar=yes')
	}
	pwindow.focus();
	return false;
}
function toggle_display(o) {
	t = getSibling(o);
	if(t.style.display=='block') {
		t.style.display='none';
		o.className='toggle_obj';
		o.style.backgroundColor='';
	} else {
		o.className='toggle_obj_selected';
		o.style.backgroundColor='#EEEEEE';
		t.style.display='block';
	}
}

function getSibling(s){
	do{
	s=s.nextSibling;
	}while(s.nodeName!='DIV'&&s.nodeName!='div');
	return s;
}
