$(document).ready(wireupInputs);

function wireUpPenSelect(){
	$('#view-pen').click(function(){
		document.location.href=$('#cmb-pens option:selected').val();	
		//have to do this to stop the post back which occurs
		return false;
		
	});
}

function clearBlankULs(){
 $('ul:empty').hide();
}

function validateStockistsClick(){
	$(".find-stockist").click(function(){	
		if($("#txt-post-code-search").val()=="" || $("#txt-post-code-search").val()==$("#txt-post-code-search").attr("title")){
			alert("Please " + $("#txt-post-code-search").attr("title"));
			return false;
		}		
	});
}

function hideDisabledLinks(){
	$('a[@disabled=true]').remove();
}

function roll(img_name, img_src){
 $('#' + img_name).attr('src',img_src);
}

function fixCols(){
	$("#content").equalizeCols();
	if ( $.browser.msie && parseInt($.browser.version)==6){
		$(".main").equalizeCols();
	}
	//check height here and readd if no content?
	var height = $('#content').attr('style').toLowerCase().replace('height: ','').replace('px;','').replace('px','');	
	if(height<460){
		$('#content').attr('style','height:460px;');	
	}
}

function wireupInputs(){
	$("input:text, textarea, input:password").each(function(){
		if(this.value == ''){
			this.value = this.title;
		}
	});
	$("input:text, textarea, input:password").focus(function(){
		if(this.value == this.title){
			this.value = '';
		}
	});
	$("input:text, textarea, input:password").blur(function(){
		if(this.value == ''){
			this.value = this.title;
		}
	});
	$("input:image, input:button, input:submit").click(function(){
		$(this.form.elements).each(function(){
			if(this.type =='text' || this.type =='textarea' || this.type =='password' ){
				if(this.value == this.title && this.title != ''){
					this.value='';
				}
			}
		});
	});

}
