function isEmail(email) {
    var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (regex.test(email)) return true;
    else return false;
}
function isEnglish(text) {
    var regex = /^([a-zA-Z]{1})+([a-zA-Z0-9_\.\-\+])+$/;
    return (regex.test(text))?true:false;
}
function isTelephone(text) {
    //var regex = /^(0-)+([0-9]{4})+([a-zA-Z0-9_\.\-\+])+$/;
	var regex = /^(0-)+([0-9]{4})+$/;
    return (regex.test(text))?true:false;
}
function isNameEnglish(text) {
    var regex = /^([a-zA-Z])+$/;
    return (regex.test(text))?true:false;
}
function resetForm(id) {
	$('#'+id).each(function(){
	this.reset();
	});
}
function clear_form(id) {
	$('#'+id).each(function(){
		this.r();
	});
}
function text2flash(){
	
	 $.sifr({
				path: '/js/',
				color: '#9F2203',
				fontSize: '30px',
				save: true
			});
	 $('h2.header').sifr({ font: 'header' });  
	  
	 $('.block_right h2').sifr({ font: 'header',fontSize:"30px",color:'#084DAE'});  
	 $('.last_news h3,.header_blue').sifr({ font: 'header',fontSize:"30px",color:"#084DAE"});  
	 $('.sub_header').sifr({ font: 'header',fontSize:"25px",color:"#084DAE"});  
	 
}
function ajax_setup_full($this){
	$.ajaxSetup({ url: $this.attr("action"),global: false, type: "POST",
			data: $this.serialize(),dataType: 'jsonp',jsonp: 'jsoncallback'
	});
}
function ajax_setup_custom(u,d){
	$.ajaxSetup({ url: u,global: false, type: "POST",
			data: d,dataType: 'jsonp',jsonp: 'jsoncallback'
	});
}
function myAlert(msg){

	$.modal.close();
	$.modal('<div align="center">'+msg+'</div>',
			{
			containerCss:{
				borderColor:"#ccc",
				height:"20px",
				padding:0,
				width:350
			},
		overlayClose :true
		});
	
}
function myAlertTime(msg){
	myAlert(msg)
	setTimeout("myClose()",2000);
}
function myClose(){
	$.modal.close();
}
function myReset(id) {
	$(id).each(function(){
	this.reset();
	});
}
function imageAlert(string){
	var width = $(document).width();
	var height = $(document).height();
	var str;
	str = 	'<div class="full_modal" style="color:white">'+
			'<div class="modal_contain" style="padding:10px;width:600px;height:500px;overflow:auto">'+
			'<div class="right">'+
			'<div class="cleardiv"></div>'+
			'<a class="close_ajax" href="#">'+
			'<img src="../images/close_ajax.png"></a></div>'+
			'<div class="cleardiv"></div>'+
			string+
			'</div></div>';
	$('body').append(str);
	$('.full_modal').css({"width":width+"px","height":height+"px"});
	$('.modal_contain img').load(function(){
		var cont  = $('.modal_contain');
		var my_height = cont.height();
		var my_width = cont.width();
		var w_width = $(window).width();
		var w_height = $(window).height();
		var top = (w_height-my_height)/2;
		var left = (w_width-my_width)/2;
		cont.css({"top":top+"px","left":left+"px"});
	});
	
	
	
}
