function valid_email( email ){
	var Exp = /^[\w-_\.]+@([\w-_]+\.)+[\w]+$/;
	var regex = new RegExp(Exp);
	return regex.test(email);
}

function valid_image( img_src ){
	var Exp = /\.(jpe?g|gif|png)$/;
	var regex = new RegExp(Exp);
	return regex.test( img_src.toLowerCase() );
}

function is_number( num ){
	var Exp = /^[0-9]+(\.[0-9])*$/;
	var regex = new RegExp(Exp);
	return regex.test(num);
}

function valid_url( url ){
	var Exp = /^http:\/\/{1}([\w-_]+\.)+[\w]+$/;
	var regex = new RegExp(Exp);
	return regex.test(url);
}

function blink_obj(oID, interval){
	window.setInterval("show_hide('" + oID + "')", interval);
}

function show_hide(oID){
	var o = document.getElementById(oID);
	if(o.style.display == "none"){
		o.style.display = "block";
	} else {
		o.style.display = "none";
	}
}

function goTo(page_url){
	window.location.href = page_url;
}

function limit_length( o, len ){
	if( o.value.length > len ){
		o.value = o.value.substr( 0, len );
	}
}

function setClass( o, css_class ){
	o.className = css_class;
}

function openWindow(URL, winName, width, height){

	if(height=='' || !height)
	height=screen.height/2
	height_factor = ((screen.height/100)*85)
	if(height>=height_factor)
		height=height_factor;


	if(width=='' || !width)
		width=screen.width/2
	width_factor = ((screen.width/100)*95)
	if(width>=width_factor)
		width=width_factor;

	var top=((screen.height-height)/2)-(screen.height/20)
	var left=(screen.width - width) / 2 ;

	win=window.open(URL, winName, 'toolbar=no,location=no,directories=no,status=0,menubar=no,scrollbars=yes,resizable=0,copyhistory=no,width='+width+',height='+height+',top='+top+',left='+left+'');
	win.focus();
}

function stopEvent(){
	evt = window.event;
	if (evt.stopPropagation){
		evt.stopPropagation();
		evt.preventDefault();
	}else if(typeof evt.cancelBubble != "undefined"){
		evt.cancelBubble = true;
		evt.returnValue = false;
	}
	return false;
}

function insertVideo( o, editorInstance ){
	var src = o.value;
	var editor = FCKeditorAPI.GetInstance( editorInstance );
	var xhtml = editor.GetXHTML();
	var video = "<div align=\"center\">" + src + "</div>"
	editor.SetHTML( xhtml + video );
	o.value = "";
}

function post_encode( html_s ){
	html_s = html_s.replace(/&/g,'%26');
	html_s = html_s.replace(/;/g,'%3B');
	return html_s;
}
