//'<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
$Q(document).ready(function(){					   
	$Q("a").focus(function(){this.blur();});
	
	$Q("#main_right .sImg").each(function(){		
		img_resize(this,100,100);	
	});
	$Q(".highslide img").each(function(){		
		img_resize(this,300,300);	
	}).click(function(){return hs.expand(this);});
	
	$Q("#dImg img").each(function(){		
		img_resize(this,300,300);	
	});
	
	$Q(".s_go").hover(
	  function(){$Q(this).addClass("s_go_on");},
	  function(){$Q(this).removeClass("s_go_on");}
	);
});	

//图片自动等比例缩放
function img_resize(obj,maxW,maxH){
	var sW=obj.width/maxW;  
	var sH=obj.height/maxH; 
	var scale=sW>sH?sW:sH;  
	obj.width=obj.width/scale;
	return false;
} 

//显示/隐藏树
function setClass(obj){
	if (obj.parentNode){
		obj=obj.parentNode;
		obj.className=obj.className=="Opened"?"Closed":"Opened";
	}
}

//是否为空
function isNull(obj) {	
	var str = /\S/;
	var con = obj.val().match(str);
	if(!con) return true;
	else return false;	
}

//检查表单
function check_form(){
	con =$Q(".s_key");	
	if(isNull(con)){
		alert("Please enter keyword!");
		con.focus();
		return false;
	}	
}

function chk_feedback()  {
	if (isNull($Q("#First_Name"))){ 
		alert('Please input your name!');
  		$Q("#First_Name").focus();
  		return false;
	}
	
	if (isNull($Q("#Company"))){ 
		alert('Please input your company name!');
  		$Q("#Company").focus();
  		return false;
	}
	
	if (isNull($Q("#Address1"))){ 
		alert('Please input your address!');
  		$Q("#Address1").focus();
  		return false;
	}
	
	if ($Q("#Country").val()=="0"){ 
		alert('Please select your country!');
  		$Q("#Country").focus();
  		return false;
	}
	
	if (isNull($Q("#Phone"))){ 
		alert('Please input your phone number!');
  		$Q("#Phone").focus();
  		return false;
	}
	
	if (isNull($Q("#Email"))){ 
		alert('Please input your email address!');
  		$Q("#Email").focus();
  		return false;
	}	
	if (($Q("#Email").val().indexOf ('@') == -1)|| ($Q("#Email").val().indexOf ('.') == -1)){ 
		alert('Email address is invalid!');
		$Q("#Email").focus();
		return false;
	}
	
	if (isNull($Q("#Comments"))){ 
		alert('Comments field is empty!');
  		$Q("#Comments").focus();
  		return false;
	}
}
