/*
$(document).ready(function() {
	//Home page thumbnail roll-overs
	$("#feature-thumbs img.thumb").each(function(index) {
		$(this).mouseover(function() {
			vSrcUrl = "images/homepage_image0" + (index + 1) + ".jpg";
			$("#large-img-bgrd").attr("src", vSrcUrl);
			return false;
		});
	});
	
	//Contact form validation
	if ($("#contactform").length > 0) {
		$("#contactform").validate({
			//Only validate when form is submitted
	   		onfocusout: false,
	   		onkeyup: false,
	   		onclick: false,
	   		
	   		//Override default error functionality to not display messages for each field
			showErrors: function(errorMap, errorList) {
				this.defaultShowErrors();					
				$("div.error span").html('Please fill in the required fields, they have been highlighted below. Please make sure e-mail is in correct format.');
				$("label.error").remove(); // Remove generated error messages.
			}   		
		})
	}
});

*/

//start contact us form show and hide cv
function showCV() {
		
		if (document.contactform.areaofinterest.selectedIndex == 1 ) {
				showdiv();
		} else {
				hidediv();	
		}
}

function showCVonload() {
	if(window.location != null && window.location.search.length > 1)
	{
		var args = getArgs();
		if (args.a) a = parseInt(args.a);
		
		if (document.contactform.areaofinterest.selectedIndex == 1 ) {
				showdiv();
		} else {
			if (a == "1"){
				showdiv();
			} else {
				hidediv();
			}
			
		}
	}
}

function hidediv() {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById('attach-cv').style.display = 'none';
	}
	else {
	if (document.layers) { // Netscape 4
	document.hideShow.display = 'none';
	}
	else { // IE 4
	document.all.hideShow.style.display = 'none';
	}
	}
}

function showdiv() {
	if (document.getElementById) { // DOM3 = IE5, NS6
	document.getElementById('attach-cv').style.display = 'block';
	}
	else {
	if (document.layers) { // Netscape 4
	document.hideShow.display = 'block';
	}
	else { // IE 4
	document.all.hideShow.style.display = 'block';
	}
	}
} 
//end contact us form show and hide cv

//search panel
function removeSearchText() {
	 if (document.getElementById('query').value == 'Search ...')
		{
			document.getElementById('query').value = '';
		}
	}
	

function getArgs() {
		var args = new Object();
		var query = location.search.substring(1);
		var pairs = query.split("&");
		for(var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
		}
			return args;
}
		