/*
	CMS Myth Global Javascript Functions
	ISITE Design
*/

// jquery no conflict. use $j or jQuery outside of ready function
var $j = jQuery.noConflict();

// jQuery document ready
jQuery(function($) {
	$('html').addClass('js');
	$('#searchform .input, #deliverform .input').inputSetter(); 
	$('#tabs').append('<li class="last"></li>');
	
	$(".playlist a").click(function(){
		var $obj 		= $(this),
			w 			= screen.width || 800,
			h 			= screen.height || 600,	
			popW 		= 400,
			popH 		= 200,	
			leftPos 	= (w-popW)/2, topPos = (h-popH)/2,
			settings 	= "status=1,location=0,menubar=0,resizable=1,scrollbars=1,width="+popW+",height="+popH+",top="+topPos+",left="+leftPos,
			newwindow 	= window.open($obj.attr("href"),"help",settings);
		return false;
	});
	
});// document ready
jQuery.fn.inputSetter = function(lower) {	
	return this.each(function() {
		var $input = jQuery(this);
		var $label = jQuery("label[for='"+$input.attr("id")+"']");
		var labeltext = lower && lower==1 ? $label.text().toLowerCase() : $label.text();
		$label.hide();	
		$input.val(labeltext);		
		$input.focus(function() { if (this.value == labeltext) { this.value = ""; }	})
			  .blur(function() { if (!this.value.length) { this.value = labeltext; } });		
	});
};
