var gebi = function(id){return document.getElementById(id);}

//Email check
function isEmail(str){
	var pos = str.indexOf('@');
	
	if(pos <= 0 || pos == str.length - 1 || pos != str.lastIndexOf('@'))
	{
	return false;
	}
	
	var sub = str.substring(pos + 1, str.length);
	
	if(sub.indexOf('.') <= 0)
	{
	return false;
	}
	
	return true;
	}
	function trim(str)
	{
	return str.replace(/^\s*|\s*$/g, "");
}

//Mobile check
 function ismobile(fData)
{
	var reg = /^(1[0-9]{10})$/;
	//var reg = /^(\+86)?(1[0-9]{10})$/;
	return reg.test(fData);
}
//Images height width
var flag=false;
function DrawImage(ImgD,FitWidth,FitHeight){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= FitWidth/FitHeight){
if(image.width>FitWidth){
ImgD.width=FitWidth;
ImgD.height=(image.height*FitWidth)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
//ImgD.alt="原图片大小("+image.width+"×"+image.height+")";
}
else{
if(image.height>FitHeight){
ImgD.height=FitHeight;
ImgD.width=(image.width*FitHeight)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
//ImgD.alt="原图片大小("+image.width+"×"+image.height+")";
}
}
}


function   left(str,len)   
	{   
	  return   str.substr(0,len)   
	}   

function search_txt( search_txt_v )
	{
		if (left( search_txt_v.value ,7) == 'Search ')
			{
				search_txt_v.value='';
				$(search_txt_v).css({ color: "#333", "font-size": "12px" }); 
			}
			
	}
	
function change_location( change_location_v )
	{
		if ( change_location_v.value == 'Pudong')
			{
				form1.venue.value = 'Community Center Shanghai - Pudong';
				form1.address.value = '2/F,The Greenhills Clubhouse,Lane 418 Jinxiu East Road,Jinqiao';
			}
		else if ( change_location_v.value == 'Puxi')
			{
				form1.venue.value = 'Community Center Shanghai - Puxi';
				form1.address.value = 'HongQiao Golf Villas Clubhouse 2/F,555 HongXu Rd (near HuaGuang Rd) or 3166 Hong Mei Rd';
			}	
	}
	
	