$(document).ready(function(){
						   
/*******************************************************
LEAVE ALL THESE ALONE - THEY ARE STANDARD
*******************************************************/
	// fixes png images for ie6.
	$(document).pngFix();

	// opens anything pdf link to a new page.
	$("a[href*=.pdf]").click(function()	{
		$(this).attr({"target":"_self"});
		return false;
	});
	
	// opens a link to a new page
	$('a[rel="external"]').click( function() {
window.open( $(this).attr('href') );
return false;
});
	
	$(".featuredPostBox:last").css("margin-bottom","0");
	
	
	
	$('input[type="text"]').addClass("idleField");
	$('input[type="text"]').focus(function() {
		/*$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}*/
	});
	$('input[type="text"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		/*if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}*/
	});
	
	$('select').addClass("idleField");
	
	$('textarea').addClass("idleField");
	$('textarea').focus(function() {
		/*$(this).removeClass("idleField").addClass("focusField");
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}*/
	});
	$('textarea').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		/*if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}*/
	});
	
	$('input[type="file"]').addClass("idleField");
	$('input[type="file"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
		/*if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}*/
	});
	$('input[type="file"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		/*if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}*/
	});
/*******************************************************
FOR THIS WEBSITE.
*******************************************************/
	$("#van-one li").hover(
		function(){ $("ul", this).fadeIn("slow"); }, 
		function() { } 
	);
	if (document.all) {
		$("#van-one li").hoverClass("sfHover");
	}

	$.preLoadImages("http://vitaver.com/img/rounded-box.png");

	$("#home").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/home_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/home_off.png");
		});
		
	
	
	$("ul#van-one ul li.page_item").each(function(){
		var thisLink = $(this);
		//alert(thisLink); .html(str);
		var linkURL = $(this).children('a').text();
		//alert(linkURL);
		$(thisLink).has('ul').children('a').text(linkURL + ' >'); //.css("text-decoration", "underline");
		$("ul#gc_list").css("text-decoration", "none");
		
	});
	
	
	
	$("#why-us").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/why_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/why_off.png");
		});
		$(".why-us").hover(
		function(){
			$("#why-us").children().attr("src","http://vitaver.com/img/navimgs/why_on.png");
			},
		function(){
			$("#why-us").children().attr("src","http://vitaver.com/img/navimgs/why_off.png");
			});			
	$("#looking-for-a-job").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/hire_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/hire_off.png");
		});
		$(".looking-for-a-job").hover(
		function(){
			$("#looking-for-a-job").children().attr("src","http://vitaver.com/img/navimgs/hire_on.png");
			},
		function(){
			$("#looking-for-a-job").children().attr("src","http://vitaver.com/img/navimgs/hire_off.png");
			});	
	$("#need-to-hire").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/jobs_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/jobs_off.png");
		});
		$(".need-to-hire").hover(
		function(){
			$("#need-to-hire").children().attr("src","http://vitaver.com/img/navimgs/jobs_on.png");
			},
		function(){
			$("#need-to-hire").children().attr("src","http://vitaver.com/img/navimgs/jobs_off.png");
			});
	$("#secrets-revealed").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/secrets_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/secrets_off.png");
		});
		$(".secrets-revealed").hover(
		function(){
			$("#secrets-revealed").children().attr("src","http://vitaver.com/img/navimgs/secrets_on.png");
			},
		function(){
			$("#secrets-revealed").children().attr("src","http://vitaver.com/img/navimgs/secrets_off.png");
			});
	$("#partnership").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/newclients_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/newclients_off.png");
		});
		$(".partnership").hover(
		function(){
			$("#partnership").children().attr("src","http://vitaver.com/img/navimgs/newclients_on.png");
			},
		function(){
			$("#partnership").children().attr("src","http://vitaver.com/img/navimgs/newclients_off.png");
			});
	$("#blog").hover(
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/blog_on.png");
		},
	function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/blog_off.png");
		});
		$(".blog").hover(
		function(){
			$("#blog").children().attr("src","http://vitaver.com/img/navimgs/blog_on.png");
			},
		function(){
			$("#blog").children().attr("src","http://vitaver.com/img/navimgs/blog_off.png");
			});
	$("#contact-us").hover(function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/contact_on.png");
		},function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/contact_off.png");
		});
	$(".contact-us").hover(function(){
		$("#contact").children().attr("src","http://vitaver.com/img/navimgs/contact_on.png");
		},function(){
		$("#contact").children().attr("src","http://vitaver.com/img/navimgs/contact_off.png");
		});
	
	$("#government").hover(function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/government_on.png");
		},function(){
		$(this).children().attr("src","http://vitaver.com/img/navimgs/government_off.png");
		});
	$(".government").hover(function(){
		$("#government").children().attr("src","http://vitaver.com/img/navimgs/government_on.png");
		},function(){
		$("#government").children().attr("src","http://vitaver.com/img/navimgs/government_off.png");
		});

	
	
	$(".jobSearch").click(function(){
		$("#jobBox").show();
		$("#employerBox").hide();
		return false;
	});
	$(".employers").click(function(){
		$("#employerBox").show();
		$("#jobBox").hide();
		return false;
	});
	
	
	
	$(".searchResultsTable tr:odd").css("background-color","#E5ECF0");


	$('#submitJobSearch').click(function() {
	  $('#searchCareersForm').submit();
	});


	$('#submitCareerAlert').click(function() {
		//alert("you hit the form");
		var email = $('[name=emailAddress]').val();//$("#careerAlertForm input [type='text']").attr("value");
		if (email == "")
		{
			$("#careerAlertForm").validate({
				rules: {
					emailAddress: "required"
				},
				messages: {
					recaptcha_response_field: " required"
				}
			});
		}
		else
		{
			$('#careerAlertForm').submit();
		}
	});
	/*$("#careerAlertForm").validate({
		rules: {
			emailAddress: "required"
		},
		messages: {
			recaptcha_response_field: " required"
		}
		//
	});*/
	
	

	// validate the contact form
	/*$("#contact_form").validate({
		rules: {
			fullName: "required",
			userEmail: "required",
			comment: "required"/*,
			recaptcha_response_field: {
				required: true,
				equalTo: "#recaptcha_challenge_field"
			}
		},
		messages: {
			fullName: " required",
			userEmail: " required",
			comment: " required",
			captcha: " required"
		}
	});*/
	
	/*
	$("#careerAlertForm").validate({
		rules: {
			emailAddress: "required"
		},
		messages: {
			recaptcha_response_field: " required"
		}
		//
	});*/
	
	
	
	//$('#contactPop').click(contactPop); 
	
	// validate the contact form
	/*
	$("#team_form").validate({
		rules: {
			fullName: {
				required: true,
				minlength: 1
			},
			userEmail: {
				required: true,
				email: true
			}		
		},
		messages: {
			fullName: " required",
			userEmail: " required"
			
		}
	});*/
	
	/*
	$("#resumeSubmitForm").validate({
		rules: {
			firstName: {
				required: true,
				minlength: 1
			},
			lastName: {
				required: true,
				minlength: 1
			},	
			fullAddress: {
				required: true,
				minlength: 1
			},					
			emailAddress: {
				required: true,
				email: true
			},
			phone1: {
				required: true,
				minlength: 1
			},			
			captcha: {
				required: true,
				minlength: 5,
				equalTo: "#captchaImage"
			}			
		},
		messages: {
			firstName: " required",
			lastName: " required",
			fullAddress: " required",
			emailAddress: " required",
			phone1: " required",
			captcha: " required"
			
		}
	});
	
	

	$("#newClientForm").validate({
		rules: {
			companyName: {
				required: true,
				minlength: 1
			},
			yourName: {
				required: true,
				minlength: 1
			},
			street: {
				required: true,
				minlength: 1
			},
			city: {
				required: true,
				minlength: 1
			},
			state: {
				required: true,
				minlength: 1
			},
			zipcode: {
				required: true,
				minlength: 1
			},
			userEmail: {
				required: true,
				email: true
			},
			website: {
				required: true,
				minlength: 8
			},
			dnbnum: {
				required: true,
				minlength: 1
			},
			bizYears: {
				required: true,
				minlength: 1
			},
			empNum: {
				required: true,
				minlength: 1
			},
			captcha: {
				required: true,
				minlength: 5,
				equalTo: "#captchaImage"
			}			
		},
		messages: {
			companyName: " required",
			yourName: " required",
			street: " required",
			city: " required",
			state: " required",
			zipcode: " required",
			userEmail: " required",
			website: " required",
			dnbnum: " required",
			bizYears: " required",
			empNum: " required",
			captcha: " required"			
		}
	});
*/
	


	// News Ticker
	//cache the ticker
		var ticker = $("#ticker");
		//wrap dt:dd pairs in divs
		ticker.children().filter("dt").each(function() {
		  
		  var dt = $(this),
		container = $("<div>");
		  
		  dt.next().appendTo(container);
		  dt.prependTo(container);
		  
		  container.appendTo(ticker);
		});
				
		//hide the scrollbar
		ticker.css("overflow", "hidden");
		
		//animator function
		function animator(currentItem) {
		
		  //work out new anim duration
		  var distance = currentItem.height();
			duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.045;

		  //animate the first child of the ticker
		  currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
			//move current item to the bottom
			currentItem.appendTo(currentItem.parent()).css("marginTop", 0);
			//recurse
			animator(currentItem.parent().children(":first"));
		  }); 
		};
		
		//start the ticker
		animator(ticker.children(":first"));
				
		//set mouseenter
		ticker.mouseenter(function() {
		  
		  //stop current animation
		  ticker.children().stop();
		  
		});
		
		//set mouseleave
		ticker.mouseleave(function() {
		  
  //resume animation
		  animator(ticker.children(":first"));
		  
		});

	
	/*******************************************************
		BLOG TICKER
	*******************************************************/
	var tickerNews = $("#tickerNews");
	//hide the scrollbar
	tickerNews.css("overflow", "hidden");
	//animatorNews function
	function animatorNews(currentItem)
	{
	  //work out new anim duration
	  var distance = currentItem.height();
		duration = (distance + parseInt(currentItem.css("marginTop"))) / 0.045;
	  //animate the first child of the tickerNews
	  currentItem.animate({ marginTop: -distance }, duration, "linear", function() {
		//move current item to the bottom
		currentItem.appendTo(currentItem.parent()).css("marginTop", 0);
		//recurse
		animatorNews(currentItem.parent().children(":first"));
	  }); 
	};		
	//start the tickerNews
	animatorNews(tickerNews.children(":first"));
	//set mouseenter
	tickerNews.mouseenter(function()
	{
	  //stop current animation
	  tickerNews.children().stop();
	});
	//set mouseleave
	tickerNews.mouseleave(function()
	{
	  //resume animation
	  animatorNews(tickerNews.children(":first"));
	});
	
	
	
	
	// REMOVING LINKS FOR JOB POSTS FROM BLOG SECTION
	//storycontent
	
	
	$('div p a:contains("APPLY")').hide();
	//$('div p a:contains("Hot Jobs section")').parent().parent().hide();
	
	
	/*
	$("#submit_Blog").validate({
		rules: {
			firstName: {
				required: true,
				minlength: 1
			},
			lastName: {
				required: true,
				minlength: 1
			},					
			userEmail: {
				required: true,
				email: true
			},
			postTitle: {
				required: true,
				minlength: 1
			},			
			postWords: {
				required: true,
				minlength: 5
			},
			agreecheck: "required"		
		},
		messages: {
			firstName: " required",
			lastName: " required",
			userEmail: " required",
			postTitle: " required",
			postWords: " required",
			agreecheck: "required"
			
		}
	});
	
	*/
	
	
	
	
	
	
}); // END DOM

// For the Dropdowns in the main menu as well.
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};	

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
  var cacheImage = document.createElement('img');
  cacheImage.src = arguments[i];
  cache.push(cacheImage);
}
  }
})(jQuery);


function openSendFriendPop()
{
	var linkURL = $('a[rel="send_to_friend"]').attr("href");
	window.open(linkURL,"Send to a Friend","menubar=no,width=580,height=240,toolbar=no" );
	return false;
}
function popUp(URL)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=580,height=240,left = 350,top = 392');");
}


function contactPop(URL)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=650,height=380,left = 350,top = 392');");
}



