/* This script is only to be used in emergencies for temporary fixes between releases */

/* Author: Kent Kobi
 * Date: 24/03/2011
 * Description: avoid error if console isn't defined (IE) */
try { console.log('initialise console, done.'); } catch(e) { console = { log: function() {} } }

/* Remove this after the spot the local campaign has finished */
$(document).ready(function(){

	if($("#customSearchResultForm").length > 0){
		$(".checkBox").each(function(){
			if($(this).attr("disabled")){
				$(this).parent().append("<input type='hidden' name='"+ $(this).attr('name') +"' value='"+$(this).attr('checked')+"'/>")
			}
		});
	}
	
	if($(".section-business-details").length > 0){	
		$(".fb-strap img.photo").each(function(){
			var tmpSrc = $(this).attr("src");
			var newSrc = tmpSrc.replace('16x16.jpg','50x50.jpg');
			$(this).attr("src", newSrc);
		})
	}
});

/* Author: Kent Kobi
 * Date: 19/01/2011
 * Button update for web activation pages for issue where type (submit) wasn't defined - ensuring form submit via js */
$(document).ready(function(){
	$("#publishButton", "#webActivationForm").bind("click", function(){
		$('#webActivationForm').submit();
	})
	
	$("#publishButton", "#submitForm").bind("click", function(){
		$('#submitForm').submit();
	})
});

/* Author: Steven Ewing
 * Date: 27/04/2011
 * Add value="true" to facebook share checkbox so that the backend will print the facebook integration javascript for sharing reviews   */
$(document).ready(function(){
	$("input[name=shareOnFB]").attr("value", true);
});

/* 
Author: Kent Kobi
Description: addition of +1 button to site, emergency.css was also updated to force position absolute (google updated and try to set the position via script)
Date: 17/06/2011

$(document).ready(function() {
	if($("body").hasClass("section-business-details")){
		$("<div style='position: relative'><div id='google-plusone' style='position: absolute!important; top: 0; right: 0;'><g:plusone></g:plusone></div></div>").insertAfter(".section-business-details .vcard .org:first");
		$.getScript('https://apis.google.com/js/plusone.js', function(){
			gapi.plusone.render("google-plusone", {"size": "standard", "count": "true"});
		});
	}
});*/

/* 
Author: Kent Kobi
Description: :)
Date: 04/11/2011
*/
$("form","#search-basic").bind("submit",function(a){var b=$("#search-basic"),c=$("#input-search-term").val();$("#easter").remove();if(c.toLowerCase()==="chuck norris"){a.preventDefault();$.ajax({type:"GET",url:"/TrackServlet?tbType=EASTER&term=chuck"});$("<div id='easter' class='panel message errors clearfix'><img src='http://media.truelocal.com.au/docs/TL_static_sites/images/logos/chuck-norris.png' class='left' /> <p style='font-size: 18px; margin: 10px 15px 10px 60px;'>You don't find Chuck Norris. Chuck Norris finds you. <sapn class='ui-icon ui-icon-dark ui-icon-closethick' style='position: absolute; right: -15px; top: -15px;'>close</a></p></div>").insertAfter(b).click(function(){$(this).fadeOut("slow",function(){$(this).remove()})})}if(c.toLowerCase()==="droids"){a.preventDefault();$.ajax({type:"GET",url:"/TrackServlet?tbType=EASTER&term=droids"});$("<div id='easter' class='panel message errors clearfix'><img src='http://media.truelocal.com.au/docs/TL_static_sites/images/logos/trooper.png' class='left' /> <p style='font-size: 18px; margin: 10px 15px 10px 60px;'>These are not the droids you are looking for. <a class='ui-icon ui-icon-dark ui-icon-closethick' style='position: absolute; right: -15px; top: -15px;'>close</a></p></div>").insertAfter(b).click(function(){$(this).fadeOut("slow",function(){$(this).remove()})})}if(c.toLowerCase()==="hal 9000"){a.preventDefault();$.ajax({type:"GET",url:"/TrackServlet?tbType=EASTER&term=hal"});$("<div id='easter' class='panel message errors clearfix'><img src='http://media.truelocal.com.au/docs/TL_static_sites/images/logos/hal-9000.png' class='left' /> <p style='font-size: 18px; margin: 10px 15px 10px 60px;'>I'm sorry, Dave. I'm afraid I can't do that. <a class='ui-icon ui-icon-dark ui-icon-closethick' style='position: absolute; right: -15px; top: -15px;'>close</a></p></div>").insertAfter(b).click(function(){$(this).fadeOut("slow",function(){$(this).remove()})})}if(c.toLowerCase()==="earl grey hot"){a.preventDefault();$.ajax({type:"GET",url:"/TrackServlet?tbType=EASTER&term=picard"});$("<div id='easter' class='panel message errors clearfix'><img src='http://media.truelocal.com.au/docs/TL_static_sites/images/logos/picard.png' class='left' /> <p style='font-size: 18px; margin: 10px 15px 10px 60px;'>You have the bridge Number One. <a class='ui-icon ui-icon-dark ui-icon-closethick' style='position: absolute; right: -15px; top: -15px;'>close</a></p></div>").insertAfter(b).click(function(){$(this).fadeOut("slow",function(){$(this).remove()})})}})

/*
Author: Kent Kobi
Description: increasing iframe height of jackmedia widgets to avoid scrolling
Date: 14/12/2011
*/
$("iframe[src*='jackmedia']").height(430);

