$(document).ready(function(){
 $('#navigation ul li').hover(function(){
  $(this).children("ul").show();
  
 },function(){
  $(this).children("ul").hide();
 });
 
 
 $('#searchup').hide();
 
 $('#searchup').click(function(){
  $('#searchup').hide();
 $('#searchdown').show();
 $('#dsearch').hide();
  
 });
 $('#searchdown').click(function(){
  $('#searchdown').hide();
 $('#searchup').show();
 $('#dsearch').show();
  
 });
 
 // search
 
 // answer submit
 $("#btm_nickname").blur( function () { 
		if($("#btm_nickname").val() =="")
		{
			$("#span_btm_nickname").html("Enter your name");
		}else
		{
			$("#span_btm_nickname").html("");
		}
 	} ); 
 	
  // answer submit
 $("#btm_emailAddr").blur( function () { 
		if($("#btm_emailAddr").val() =="")
		{
			$("#span_btm_emailAddr").html("Enter your email address");
		}else 
		{
			var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
	      	 var email_val = $("#btm_emailAddr").val();
	      	 if(search_str.test(email_val)){
	       		$("#span_btm_emailAddr").html("");
	      	 }else{
	       		$("#span_btm_emailAddr").html("Your entries must match. Please check both.");
	       }
       
			
		}
 	} ); 
 	
 	
 	 $("#btm_replyContent").blur( function () { 
		if($("#btm_replyContent").val() =="")
		{
			$("#span_btm_replyContent").html("Enter your Question");
		}else
		{
			$("#span_btm_replyContent").html("");
		}
 	} ); 
 	
 	
 	
 	 $("#btm_submit").click( function () { 
		
 	 	if($("#btm_nickname").val() =="")
		{
			$("#span_btm_nickname").html("Enter your name");
			return false;
		}else
		{
			$("#span_btm_nickname").html("");
			
		}
		
		if($("#btm_emailAddr").val() =="")
		{
			$("#span_btm_emailAddr").html("Enter your email address");
			return false;
		}else 
		{
			var search_str = /^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/;
	      	 var email_val = $("#btm_emailAddr").val();
	      	 if(search_str.test(email_val)){
	       		$("#span_btm_emailAddr").html("");
	      	 }else{
	       		$("#span_btm_emailAddr").html("Your entries must match. Please check both.");
	       		return false;
	       }
       
			
		}
		
		if($("#btm_replyContent").val() =="")
		{
			$("#span_btm_replyContent").html("Enter your Question");
			return false;
		}else
		{
			$("#span_btm_replyContent").html("");
		}
		
		
		// ajax Ìá½»Êý¾Ý
		$.post("http://www.bigbigsoft.com/getquestion/index/", { nickname: $("#btm_nickname").val(), emailAddr: $("#btm_emailAddr").val(),replyContent: $("#btm_replyContent").val(),act: $("#btm_act").val()},
		  function(data){
		    $("#btm_result_info").html('<div class="btm_blue">Submitted successfully!<br />Please note: We are unable to respond to most comments due to the volume, but we do read them all. </div>');
		  }); 
		
		
 	} ); 
 
});

$(function(){
    $("ul.dropdown li").hover(function(){
    
        $(this).addClass("dropdown_hover");
        $('ul:first',this).css('visibility', 'visible');
    
    }, function(){
    
        $(this).removeClass("dropdown_hover");
        $('ul:first',this).css('visibility', 'hidden');
    
    });
    
    //$("ul.dropdown li ul li:has(ul)").find("a:first").append(" &raquo; ");
});

function topsearchsubmitbutton(urlV)
{
	var p = $("#topsearchvalue").val();
	var url = urlV+"/p/"+p;
	location.href=url;
}


jQuery(function() {
    var onAutocompleteSelect = function(value, data) {
      $('#selection').html('<img src="\/global\/flags\/small\/' + data + '.png" alt="" \/> ' + value);
      //alert(data);
    }

   // alert($("#t").val());
  //  var service_url_value = 'http://192.168.3.200/bigbigsoft/search/checkurl/';
   
    var service_url_value = 'http://www.bigbigsoft.com/search/checkurl/';
 	 var options = {
      serviceUrl: service_url_value,
      width: 300,
      delimiter: /(,|;)\s*/,
      onSelect: onAutocompleteSelect,
      deferRequestBy: 0, //miliseconds
      params: { country: 'Yes'  },
      noCache: true //set to true, to disable caching
    };

 	a1 = $('#topsearchvalue').autocomplete(options);
 
 });




