$(document).ready(function() {
	
	$('.menuItem').mouseover(function() {
		//$('.show',this).css('display', 'block');
		$(this).children('a').addClass('hover');
	});
	$('.menuItem').mouseout(function() {
		//$('.show').css('display', 'none');
		$('a',this).removeClass('hover');
	});
/* seems not to be in use anylonger
	$('.view2').click(function() {
		return;
		product=$(this).parents('.product');
		$('.view', product).click();
	});
	$('.view').toggle(function() {
		return;
		product=$(this).parents('.product');
		$('.view',product).html('|&nbsp;&nbsp;View&nbsp;&nbsp;&nbsp;&nbsp;<img class="arrow" src="/images/arrowDown.png" alt="Arrow" />');
		$('.options',product).slideUp('slow');
	},function() {
		return;
		//$('.view').html('|&nbsp;&nbsp;View&nbsp;&nbsp;&nbsp;&nbsp;<img class="arrow" src="/images/arrowDown.png" alt="Arrow" />');
		product=$(this).parents('.product');
		$('.view', product).html('|&nbsp;&nbsp;Close&nbsp;&nbsp;&nbsp;&nbsp;<img class="arrow" src="/images/arrowUp.png" alt="Arrow" />');
		$('.options').slideUp('slow');
		$('.options',product).slideDown('slow');
	});
*/
	h = window.location.hash.replace(/^#/,"");

	if (h && h.indexOf("/")==0) {
		url = h+"&TB_iframe=true&height=622&width=680";
		tb_show(null, url, false);
	}
	prev_hash = window.location.hash;
	setTimeout("checkHash();",200);
	
	
	
	// tooltip
	/////////////////////////////
	$('.tooltip').tooltip({ showURL: false  });
	
	// validate
	/////////////////////////////
	$(".contactForm").validate({
	  	errorPlacement: function(error, element) {
	  		error.appendTo( element.parents('p').addClass('error') );
	  	},
	  	highlight: function( element, errorClass ) {
	  		$( element ).addClass( errorClass ).parents('p').removeClass('success').addClass('error');
	  	},
	  	unhighlight: function( element, errorClass ) {
	  		$( element ).removeClass( errorClass ).parents('p').removeClass('error').addClass('success');
	  	},
			messages: {
				email: {
					required: 'Enter this!'	
				}
			}
	  });
	
});

var prev_hash;

function checkHash() {
	if (prev_hash != window.location.hash) hashChanged2();
	prev_hash = window.location.hash;
	setTimeout("checkHash();",200);
}
function hashChanged2() {
	if (prev_hash.indexOf('.php')==-1 || window.location.hash.indexOf('.php')!=-1) return;
	//browser back button pressed with popup opened 
	tb_remove();
}

function clearBoxText(name){
	if (document.getElementById(name).value == '(please enter)'){
		document.getElementById(name).value = '';
	}
}
function replaceBoxText(name){
	if (document.getElementById(name).value == ''){
		document.getElementById(name).value = '(please enter)';
	}
}


