// JavaScript Document

$(document).ready(function() {

 $(".searchfield").focus(function(){
	$(".searchfield").addClass('searchfieldovr');
	if(document.getElementById('keywords').value=='Search Website')
	  document.getElementById('keywords').value='';
	  document.getElementById('searchbtn').src='images/search-ico-r.png';
	  
	});
 
  $(".searchfield").blur(function(){
					$(".searchfield").removeClass('searchfieldovr');
					 
					if(document.getElementById('keywords').value=='')
					{ document.getElementById('searchbtn').src='images/search-ico.png';
	  					document.getElementById('keywords').value='Search Website';}
					});
//for menu
   $(".navmain").each(function() {
     $(this).mouseover(function()
	 {
		
		 $(this).addClass("navovr");
	 })
	
	 $(this).mouseout(function()
	 {$(this).addClass("navmain");
		 $(this).removeClass("navovr");
		 hideMenuDivs();
		
		 })
	 
	 
	 });
   
 //for left menu
   $(".subcatlink").each(function() {
     $(this).mouseover(function()
	 {
		
		 $(this).addClass("subcatlinkovr");
	 })
	
	 $(this).mouseout(function()
	 {$(this).addClass("subcatlink");
		 $(this).removeClass("subcatlinkovr");
		
		
		 })
	 
	 
	 });
	 
	  }); 

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages("images/menu-down-back.jpg", "images/buttonr-r-back.gif",
"images/button-r-right.png","images/button-r-left.png","images/button-back.gif","images/button-right.png","images/button-left.png","images/side-menu-back","images/menu-btm-bg.gif","images/menu_sep.gif","images/menu-down-rightcorner.png","images/menu-down-leftcorner.png");


//loop to hide all other divs
//"solutionsMenu","solutionsBtn",
var divArr=new Array("companyMenu","companyBtn","portfolioMenu","portfolioBtn");
var menuTimeOut;
function showDiv(subdiv)
{
	clearTimeout(menuTimeOut);
	
	for(var i=0;i<divArr.length;i+=2)
	{
		 if(subdiv!=divArr[i])
		 {
		 	 document.getElementById(divArr[i]).style.display='none';
			 document.getElementById(divArr[i+1]).className='navmain';
		 }
		 else
		 
		 {			document.getElementById(divArr[i+1]).className='navovr';
		//alert(	document.getElementById(divArr[i+1]).className);
		 
			 }
			
  //  $('#'+divArr[i]).fadeOut("slow");
	}
		 document.getElementById(subdiv).style.display='';
//	 $(subdiv).fadeIn("slow");
	
	
  
}

function hideAllDivs()
{
	
menuTimeOut=setTimeout("hideMenuDivs()",500);
	}
	
	function hideMenuDivs()
	{
		
		for(var i=0;i<divArr.length;i+=2)
	{
	 document.getElementById(divArr[i]).style.display='none';	
	  document.getElementById(divArr[i+1]).className='navmain';
   // $('#'+divArr[i]).fadeOut("slow");
	}
	}
	
	
function swapImage(img,newsrc)
{
	
	$('#'+img).attr("src",newsrc);
}

$(document).ready(function() {

	 
	 
	 //for form fields
	    $(".frmfield").each(function() {
     $(this).focus(function()
	 {$(this).addClass("frmfieldovr"); })
	
	 $(this).blur(function()
	 {$(this).removeClass("frmfieldovr");
	 $(this).addClass("frmfield");
	  })
	 
	 
	 
	 });
		
		 //for form text areas
	    $(".frmarea").each(function() {
     $(this).focus(function()
	 {$(this).addClass("frmareaovr"); })
	
	 $(this).blur(function()
	 {$(this).removeClass("frmareaovr");
	 $(this).addClass("frmarea");
	  })
	 
	 
	 
	 });
		
		
		//buttons mousseover
		  $(".frmbutton").each(function() {
     $(this).mouseover(function()
	 {$(this).addClass("frmbuttonovr"); })
	
	 $(this).mouseout(function()
	 {$(this).removeClass("frmbuttonovr");
	 $(this).addClass("frmbutton");
	  })
	 
	 
	 
	 });
	 
	

 });
function toggleDiv(subdiv,maindiv)
{
	
	
	 if(document.getElementById(subdiv+'sign').innerHTML=="+")
	{   document.getElementById(subdiv+'sign').innerHTML="-";
	    $('#'+maindiv).addClass('leftnavlinksel');
	}
	 else
	 { document.getElementById(subdiv+'sign').innerHTML="+";
	  $('#'+maindiv).removeClass('leftnavlinksel');
	 }
	 $("#"+subdiv).slideToggle("slow");
	 
	
	}
	
    var name = "#floatMenu";
    var menuYloc = null;
	
    $(document).ready(function(){
        menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
        $(window).scroll(function () { 
            var offset = menuYloc+$(document).scrollTop()+"px";
            $(name).animate({top:offset},{duration:500,queue:false});
        });
		
		$(name).click(function(){
		$.blockUI({ message: $('#consDiv'),css:{ top:'10%',left:'25%',width:'690px' } });
		});
		
		$("#linkCons").click(function(){
		$.blockUI({ message: $('#consDiv'),css:{ top:'10%',left:'25%',width:'690px' } });
		});
    }); 

		
	var consDiv="#consDiv";
	var consSettings="css:{ top:'10%',left:'25%',width:'690px' }";
	
