// JavaScript Document
//want $ to work with other libs

$(document).ready(noselect);

function noselect(){	
	// $(disableSelection(document.getElementById("imageflow")))
	if ( $("#imageflow").length > 0 ) {
		$(disableSelection("#imageflow"));
	}
};

$(document).ready(sidebar);

function sidebar(){
    $("#sidebar1,#innercontent").equalizeCols(0);
};

$(document).ready(homeinfo);

function homeinfo(){
    $(".homeinfo").equalizeCols(0);
};


//used by filter drop down 
$(document).ready(filterRedirect);
function filterRedirect(){

	$('#filter').change(function(){

		document.location.href=document.location.href.split('?')[0] + '?filter=' + encodeURIComponent($('#filter option:selected').val());
	 //have to do this to stop the post back which occurs
	 //return false;
 });

};

//
$(document).ready(redirectToStockistsSearch);
function redirectToStockistsSearch(){
  $('#stockistSearch').click(function(){
	//if($('#location option:selected').val()!='' && $('#location option:selected').val()!='Please select filter'){
  	  document.location.href = $('#searchFormRedirect').val() + "?location=" + encodeURIComponent($('#location option:selected').val());
	//}
	//else{
	//	alert("Please select location");
	//}
     }
  );
}

$(document).ready(alterTable);
function alterTable()
{
 $('span:contains("(not shown)")').hide();
 $('span:contains("optional")').hide();
 $('fieldset p:eq(2) input').after("<br />&nbsp;(optional - remember http://)<br /><br />");
 $('fieldset p:eq(1) input').after("<br />&nbsp;(Personalise your comments with a <a href=\"http://en.gravatar.com\" target=\"blank\" title=\"Get yourself a Gravatar\">Gravatar</a>)<br /><br />");

}

