$(document).ready(function () {

	jQuery("#mMenuArrow2").click(function () {
		if(jQuery("#drillmenu1").hasClass("hide")) {
			jQuery("#drillmenu1").removeClass("hide");
			jQuery("#drillmenu1").addClass("show");
		} else if(jQuery("#drillmenu1").hasClass("show")) {
			jQuery("#drillmenu1").removeClass("show");
			jQuery("#drillmenu1").addClass("hide");
		}
	});

	jQuery("a[rel='mItem']").click(function () {
		var poop = jQuery(this).text();
		jQuery("#mMenu").text(poop);
		jQuery("#drillmenu1").removeClass("show");
		jQuery("#drillmenu1").addClass("hide");
		
		if(jQuery(poop)!="Select Rental Equipment") {
			jQuery("#catG").val(poop);
		}
	});
	
	jQuery("#arrowImg, #searchBut, #btnHome, #btnSearch, #btnLogin, #btnMan, #btnAbout, #btnAdv, #btnContact, #sRequest").hover(function () {
		this.src = this.src.replace("_off","_on");
	}, function () {
		this.src = this.src.replace("_on","_off");
	});
	
	jQuery("#indexLoc").attr({ value: 'City, State or Zipcode' }).focus(function(){
		jQuery(this).css({'background' : '#FFF4DF'});
		if(jQuery(this).val()=="City, State or Zipcode"){
			jQuery(this).val("");
      }
	}).blur(function(){
		jQuery(this).css({'background' : '#ffffff'});
	   if(jQuery(this).val()==""){
         jQuery(this).val("City, State or Zipcode");
      }
	});
	
	jQuery('.phone').click(function() {
		jQuery(this).text(jQuery(this).attr('id'));
	});
	
	
	jQuery('#browse > li').bind('mouseover', browse_open);
	jQuery('#browse > li').bind('mouseout', browse_timer);
	
	
	jQuery('#main').click(function () {
		window.location = 'http://www.rentalhawk.com/index.php';
	});
	jQuery('#hover').click(function() {
		return false;
	});
	jQuery('#rcgo').click(function() {
		window.location = 'http://www.rentalhawk.com/advertise.php';
	});
	
	
	jQuery(".work").hover(function() {
		jQuery("#hover").stop().animate( { 'top' : '110px' }, 'fast' );
	},function () {
		jQuery("#hover").stop().animate( { 'top' : '172px' }, 'fast' );
	});

});

function pclick(id) {
	jQuery(document).ready(function () {
		jQuery.get("/includes/p_clicks.php", { id: (id) } );
		jQuery(".phoneBox"+id).fadeIn("slow");
	});
}
function eclick(id) {
	jQuery(document).ready(function () {
		jQuery.get("/includes/e_clicks.php", { id: (id) } );
	});
}
function sclick(id) {
	jQuery(document).ready(function () {
		jQuery.get("/includes/s_clicks.php", { id: (id) } );
	});
}


/*** Dropdown vars and funcs ***/
var timeout = 500;
var closetimer = 0;
var dropmenuitem = 0;
function browse_open() {
	browse_canceltimer();
	browse_close();
	dropmenuitem = jQuery(this).find('ul').css({ 'visibility' : 'visible' });
}
function browse_close() {
	if(dropmenuitem) { 
		dropmenuitem.css({ 'visibility' : 'hidden' });
	}
}
function browse_timer() {
	closetimer = window.setTimeout(browse_close, timeout);
}
function browse_canceltimer() {
	if(closetimer) {
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

document.onclick = browse_close;
/*** End vars and funcs ***/