function sendEnquiry() {
	var email = $('#SendMessage1_send_Email').val();
	reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
	if(!reg.test(email)) {
		alert(emailCorrect);return;
	}
	var title = $('#SendMessage1_send_Title').val();
	var content = $('#SendMessage1_senddesc').text();
	if(content.length < 20) {
		alert(unavailableContent);return;
	}
	$('#sendForm').submit();
}
function searchProduct(obj) {
	if(obj == '' || obj == inputKey) {
		return;
	}
	 var keyword = encodeURIComponent(obj);
	 window.location= contextPath + '/search/gallery1/' + encodeURI(keyword) + '.html';
}
function refreshCerCode() {
	$("#regioncode").attr("src",$('#contextpath').val() + "/validate-code?param=" + new Date().getTime());
	setVCode();
}
function changeLanguage(languageCode) {
	$.ajax({
        type: "get",
        url: "change-lan-single-and-muti-mod?languageCode=" + languageCode + "&param=" + new Date().getTime(),
        success: function(data) {
                 },
        error:function(){
                 alert('error');
              }
   });
}
$(function(){
	 $('#nav ul li').mouseover(function(){
		 $(this).find('.list').show();  
		 $(this).find('a:not(#nav ul li ul li a)').addClass('active');
     });
	 $('#nav ul li').mouseout(function(){
	     $(this).find('.list').hide();
	     $(this).find('a:first').removeClass('active');
     });
	 if($('#categories .categoriesbg').css('cursor') != 'pointer') {
		 $('#categories ul li').not('#categories ul li ul li').mouseover(function(){
			 var checkElement = $(this).find('ul:first'); 
			 if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {  
				  $('#categories ul li ul:visible').hide();  
			      checkElement.show();  
			      return false;  
	         }  
			 $(this).attr('class','on').siblings().attr('class','').has('ul:visible').attr('class','on'); 
	     });
	 }
	 $('#categories .categoriesbg').click(function() {
		 var checkElement = $(this).parent().find('ul:first'); 
		 if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {  
		      checkElement.show();  
		      $(this).parent().attr('class','on').siblings().attr('class','').has('ul:visible').attr('class','on');
		      return false;  
         }else {
        	 checkElement.hide();  
        	 $(this).parent().attr('class','');
		     return false;
         }  
	 });
	 $('#categories ul li ul li').not('#categories ul li ul li ul li').mouseover(function(){
		 var checkElement = $(this).find('ul:first'); 
		 if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {  
			  $('#categories ul li ul li ul:visible').hide();  
		      checkElement.show();  
		      return false;  
         }  
		 //$(this).attr('class','on').siblings().attr('class','').has('ul:visible').attr('class','on'); 
     });
	 if(currentGid != '') {
		 $('#categories').find('a').each(function() {
			 var groupHref = $(this).attr('href');
			 var gid = groupHref.substring(groupHref.indexOf("gid") + 3,groupHref.lastIndexOf("/"));
			 if(gid == currentGid) {
				 $(this).addClass('active');
				 $(this).parent().find('ul:first').show();
				 $('#categories ul').has(this).show();
				 return false;
			 }
		 });
	 }
	 $('#technical a').click(function() {
		 var con = $(this).text() - 1;
		 $(this).addClass('on').siblings().removeClass('on');
		 $('#technical .content:eq(' + con + ')').show().siblings().filter('.content').hide();
	 });
	$('.search_text').click(function() {
		$(this).val('');
	});
	$('.search_text').blur(function() {
		var inputItem = $('.search_text').val();
		if(inputItem == '' || inputItem == inputKey) {
			$(this).val(inputKey);
		}
	});
	document.getElementsByTagName("body")[0].oncopy = function() {
		if(cpPer != '' && cpPer == 'false') {
			return false;
		}
	};
	$('#SendMessage1_send_Email').focus(function() {
		$(this).attr('class','on');
	});
	$('#SendMessage1_send_Email').blur(function() {
		$(this).attr('class','');
	});
	$('#SendMessage1_send_Title').focus(function() {
		$(this).attr('class','on');if($(this).val()==$('#send_Title_loadingValue').val()){$(this).val('');}
	});
	$('#SendMessage1_send_Title').blur(function() {
		$(this).attr('class','');if($.trim($(this).val())==''){$(this).val($('#send_Title_loadingValue').val());}
	});
	$('#SendMessage1_senddesc').focus(function() {
		if($(this).val()==enterMessage){$(this).val('');}
	});
	$('#SendMessage1_senddesc').blur(function() {
		if($.trim($(this).val())==''){$(this).val(enterMessage);}
	});
	$("#sel_btn").click(function(){ 
	   if( $('#languageList').css('display') == 'none') {
		   $('#languageList').slideDown("fast"); 
	   }else {
		   $('#languageList').slideUp("fast"); 
	   }
	});
	$("#sel_btn").blur(function(){ 
		$('#languageList').slideUp("fast"); 
	});
	$("#languageList li").mouseover(function() {
		$(this).addClass('on');
	});
	$("#languageList li").mouseout(function() {
		$(this).removeClass('on');
	});
    $("#languageList li a").click(function(){ 
	    var openType = $(this).attr("target");
	    if(openType == '_self') {
	    	var txt = $(this).html();
	    	$("#sel_btn").html(txt); 
	    }
	    $("#languageList").hide(); 
	}); 
});

