
$(document).ready(function()
{
	//$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	$("ul.topnav li a.mmenu").hover(
									function()
									{
										$(this).parent().find("ul.subnav").slideDown('fast').show();
										$(this).addClass("subhover");
										$(this).css("color", "#ffffff");
										$(this).find("#comm").css("color", "#fff");
										$(this).parent().hover(
																function() {},
																function() {
																			$(this).parent().find("ul.subnav").slideUp(100,
																												function()
																												{
																													$(this).parent().find("a.mmenu").removeClass("subhover");
																													$(this).parent().find("a.mmenu").css("color", "#333");
																													$(this).parent().find("a.mmenu #comm").css("color", "#333");
																												}
																													);

																			}
																);
									}
								);


	$("ul.topnav-en li a.mmenu").hover(
									function()
									{
										//$(this).parent().find("ul.subnav").slideDown('fast').show();
										$(this).addClass("subhover");
										$(this).css("color", "#ffffff");
										$(this).find("#comm").css("color", "#fff");
										$(this).parent().hover(
																function() {},
																function() {
																			$(this).parent().find("a.mmenu").removeClass("subhover");
																			$(this).parent().find("a.mmenu").css("color", "#333");
																			$(this).parent().find("a.mmenu #comm").css("color", "#333");

																			}
																);
									}
								);

});

$(document).ready(function(){

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});

});

function predict(menu,str,targetID,targetObj)
{
	var xmlhttp;
    try { xmlhttp=new XMLHttpRequest(); }
    catch(e)
    {
        try { xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); }
        catch(e)
        {
            try { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
            catch(e)
            {
                //alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }

	if(menu == 'prseek')
	{
		if(str.length > 2)
		{
		    var url='/qsearch-process.php?mode=prseek&data='+str;
		    xmlhttp.onreadystatechange=function()
		    {
		        if(xmlhttp.readyState == 4)
		        {
		        	if(xmlhttp.responseText.length > 1)
		        	{
		        		document.getElementById('qres').style.display = 'block';
			        	document.getElementById('qres').innerHTML=xmlhttp.responseText;
			        }
		        }
		    }
		    xmlhttp.open("GET",url,true);
		    xmlhttp.send(null);
		}
		else
		{
		        		document.getElementById('qres').style.display = 'none';
			        	document.getElementById('qres').innerHTML = '';
		}
	}
	else if(menu == 'irseek')
	{
		if(str.length == 4)
		{
		    var url='/qsearch-process.php?mode=irseek&data='+str;
		    xmlhttp.onreadystatechange=function()
		    {
		        if(xmlhttp.readyState == 4)
		        {
		        	if(xmlhttp.responseText.length > 1)
		        	{
		        		if(targetID)
		        		{
			        		document.getElementById(targetID).value = xmlhttp.responseText;
			        	}
			        	else if(targetObj)
			        	{
			        		targetObj.value = xmlhttp.responseText;
			        	}
			        }
		        }
		    }
		    xmlhttp.open("GET",url,true);
		    xmlhttp.send(null);
		}
	}
}

function swapLG()
{
	if(document.getElementById('Lform').style.display == 'block')
	{ document.getElementById('Lform').style.display = 'none'; document.getElementById('Fform').style.display = 'block'; }
	else
	{ document.getElementById('Lform').style.display = 'block'; document.getElementById('Fform').style.display = 'none'; }
}
