// JavaScript Document
function checkheight()
{
	var h = document.getElementById('right_content').style.height;
	//alert(document.getElementById('right_content').style.height);

}
var id="logo";
var img0 ="../theme/default/template/images/logo";
var img0_suffix = ".jpg";

function swap(img,id){	var obj = document.getElementById(id); 	obj.src = img;	}
function logo_over(){ var img = img0+"2"+img0_suffix; swap(img,id); }
function logo_out(){ var img = img0+"1"+img0_suffix; swap(img,id); }
	
function checkemail_subscribe(lan)
{
  var obj,url,from;
  var note1,note2;
  var ap;
  obj = document.getElementById('email_sub');
  from = obj.value;
   
	if(from !=''){   
	    if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(from)){ 
	     if(lan=='cn'){ note1='Please input the correct e-mail address!' }else{ note1="Please input the correct e-mail address!"}
		 alert(note1);
	      }
		 else { 
		 ap = (lan=='cn') ? "http://originsh.com/english/subscription/" : "http://originsh.com/english/subscription/";
		 if(lan=='home'){ ap = "http://originsh.com/english/subscription/";} 
		 url = ap +from;  
		 window.open(url); 
		 }
		
     } 
     else {
		  alert("Please input your e-mail address!");
		  }
    }
function checkemail(lan)
{
  var obj,url,from;
  var note1,note2;
  obj = document.getElementById('feedbacks');
  from = obj.from.value;

	if(from !=''){   
	    if(!/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(from)){ 
	     if(lan=='cn'){ note1='请输入正确的邮件地址!' }else{ note1="Please input the correct e-mail address!"}
	      }
		 else { 
		 obj.action = "feedback_send.php";
		 obj.submit();
		 }
     } 
     else {
		  alert("Please input your e-mail address!");
		  }
    }
	
function getemail(){
 var url,arr,obj;
 obj = document.getElementById('em_wfs_formfield_1341916');
 url = document.location;
 url = "'"+url;
 arr=url.split('/');
 var myemail = arr[arr.length-1];
 if(myemail != null){ obj.value = myemail; }
 
}

function sends()
{
 var f = document.getElementById('em_subscribe_form');
 var em = document.getElementById('em_wfs_formfield_1341916');

 if(em.value !=''){
 f.submit();
 //document.location = "index.html";
 window.close();
 }
 else { alert("please input your email!");}
 }
 
function show_image(id)
{
var w_width = document.body.clientWidth;
var width_obj = 976;
var obj_x = document.getElementById(id); 
if(w_width < width_obj){ obj_x.style.display="none";}else{obj_x.style.display="block";}
}
//
function changeLogoOut(obj){
 
 obj.src="../../image/logo-origin.png"; 
}
function changeLogoOver(obj){
 obj.src="../../image/logo-origin-dark.png"; 
}

function changeFoodMenuOver(obj){
  obj.src="../../image/top-food-menu-light.png"; 
  }

function changeFoodMenuOut(obj){
  obj.src="../../image/top-food-menu.png"; 
  }
  
//section of show image 
var obj;
function adjustHeight(t){
  obj = t; 
  var t=setInterval("adjustHeightDo()",300);
  }

 function adjustHeightDo(){ 
 var target = document.getElementById(obj);
 var  defaultHeight = 500;
 var currentHeight = target.clientHeight;
  
 
 if(currentHeight <=defaultHeight){
 target.style.height = 500+"px";
  clearimageshow();
 //alert(currentHeight);
 }else if(currentHeight >defaultHeight && currentHeight <800 ){
  clearimageshow();
 }else if(currentHeight > 800){
  document.getElementById("imageshow").style.height = (target.clientHeight - 540 )+ "px";
  showimageshow();
  }else{
   clearimageshow();
   }

 }
function showimageshow(){
 var obj = document.getElementById("imageshow");
 obj.style.display = "block";
 }

function clearimageshow(){
 var obj = document.getElementById("imageshow");
 obj.style.display = "none";
 obj.innerHTML = "";
}