// toolBox Jquery Code
var loaderMsg = "Please Wait";
// printer function
function prePrint()
{
	if (window.print) window.print();
	else alert('To print this document, choose File > Print in your browser menu.');
}

//bookmark function 

function addBookmark() 

{	
	var title = document.title;			
	var url = document.location.href;
	if (window.sidebar)	window.sidebar.addPanel(title, url,"");
 	else if( document.all )   window.external.AddFavorite( url, title);
	else return true;
}

/*----------------------------------------------------------------
 start:: Send to friend code
 -------------------------------------------------------------------*/
// print btn function
$(document).ready(function(){
	$(".printBtn a").click(function(){
	prePrint();				   		   
	});

	$(".favoritesBtn a").click(function(){
	addBookmark();				   		   
	});


});



$(document).ready(function(){
$("#sendToFriendHolder").hide();
// set to 0 dimensions
	$("#sendToFriendHolder").animate({ 
        width: "0px",
		height: "0px",
        opacity: 0
      }, 1 );


//toolbox Action Btn
$(".sendBtn").click(function(){
	sendTofriend.resetForm();
	$("#sendToFriendResult").html("");
	$("#sendToFriendHolder").animate({ 
        width: "400px",
		height: "170px",
        opacity: 100
      }, 500 );
});


//Toolbox Close Btn
  $("#sendToFriendCloseBtn").click(function() {
	$("#sendToFriendResult").html("");										
	sendTofriend.resetForm();

	$("#sendToFriendHolder").animate({ 
        width: "0px",
		height: "0px",
        opacity: 0
      }, 500 );
	 
	});


var sendTofriend = $("#sendToFriendForm").validate({
errorElement: "div",
errorContainer: "#sendToFriendError",
errorPlacement: function(error, element) {
$("#sendToFriendError").html("");
error.appendTo("#sendToFriendError");
}, 
submitHandler: function(form){$(form).ajaxSubmit({
beforeSubmit:function(){
$("#sendToFriendResult").html("");

//IE7 has opacity problems when using clear type 
// removing the filter fixes the bug when jQuery animate effect used
var $holder = $('#sendToFriendHolder');
if ($.browser.msie){
    $holder[0].style.removeAttribute('filter');
}
$holder.block({
	  message: '<span class="waitMsgToolBox">'+ loaderMsg +'</span>', 
     css: {  border: '1px solid #cccccc',padding: '5px',	width:'80%',cursor: 'wait'}
}); 

},
success:function(){
//clear form
sendTofriend.resetForm();
//unblock holder
$("#sendToFriendHolder").unblock();
return false;
},
target: "#sendToFriendResult"
});

},
rules: {
		sendToFriendVisitorEmail: {
									required:true,
									email:true
								  },
		sendToFriendRecipientEmail: {
									required:true,
									email:true
								  }						
       }
});// end: Validator



});

// JavaScript Document
/*----------------------------------------------------------------
  end:: Send to friend code
 -------------------------------------------------------------------*/
