/*-----------------------------------------------
VB3 Core JS
Author: Andy Sherman
Created: 02/20/09
Description: Core JS function include [all pages]
Mod:
Notes:
* code relating to globalNav in gNFunct.js
-----------------------------------------------*/

jQuery(document).ready(function() {	
	/*---------------------------
	primeNav mouseOver animation
	---------------------------*/
	$("ul#primNav li a").hover(function() {
		if(!$(this).hasClass("active")){
			$(this)
			.css({backgroundPosition: "150px"})
			.animate({backgroundPosition: 0}, 200)
		}
	});	
	
	/*---------------------------------------
	contact form link dynamic js asssignment
	----------------------------------------*/
	//get all a tags with class="contactLink"
	var cLinks = $("a.contactLink");
	
	//itearate through links array
	for(i=0;i <=(cLinks.length -1);i++) {
		//set href to javascript:void(0);
		$(cLinks[i]).attr('href', 'javascript:void(0);');
		//append onclick attribute with call to gNAnimate function
		$(cLinks[i]).bind('click',function(){
		    gNAnimate('gNContactForm','gNContact');
			//append id to link when clicked for anchoring back
			$(this).attr("name", "iwashere");
			
		    return false;
		  });
	}
	
	/*----------------------------------------
	gN contact/search link dynamic js assign
	-----------------------------------------*/
	//gNContact
	$('#gNContact').attr('href', 'javascript:void(0);');
	//append onclick attribute with call to gNAnimate function
	$('#gNContact').bind('click',function(){
	    gNAnimate('gNContactForm','gNContact');
	    return false;
	});
	
	//gNSearch
	$('#gNSearch').attr('href', 'javascript:void(0);');
	//append onclick attribute with call to gNAnimate function
	$('#gNSearch').bind('click',function(){
	    gNAnimate('gNSearchForm','gNSearch');
	    return false;
	});
	
	/*---------------------------------------
	assign new window funct to external links
	----------------------------------------*/
	var extLinks = $('a');
	 for (var i=0; i<extLinks.length; i++) {
	   var extLink = extLinks[i];
	   if ($(extLink).attr("href") && $(extLink).attr("rel") == "external") {
		extLink.target = "_blank";
		}
	 }
	
	/*-------------------------------
	about > company
	- functionality for webWish form
	--------------------------------*/
	
	//find input field
	var wDInfoBox = $("#webDreamInfoBox");
		
	//set onfocus funcitonality
	$("input#webDreamRequest").focus(function() {
		// animate opacity to full
		//$(wDInfoBox).stop().animate({opacity: 1}, "slow"); /*animation causes wierd artifacts around alphaed bg*/
		$(wDInfoBox).css("display","block");	
	})
	
	//append click function to close button
	$("#webDreamInfoBox p.close").bind('click',function(){
	   	$(wDInfoBox).css("display","none");
	    return false;
	});
	
	
	

//end doc.ready Statement
});
