//Included jquery plugins
document.write('<script type="text/javascript" src="/lib/cornerz.js"></script>');
document.write('<script type="text/javascript" src="/lib/jquery.colorize-1.3.1.js"></script>');
document.write('<script type="text/javascript" src="/lib/facebox.js"></script>');
document.write('<script type="text/javascript" src="/lib/jFav_v1.0.js"></script>');
document.write('<script type="text/javascript" src="/lib/jquery.form.js"></script>');
document.write('<script type="text/javascript" src="/lib/datepicker.js"></script>');

$(document).ready(function(){
        $('.ctop').cornerz({radius:12, corners: 'tl tr', background:'#e9e8e4'})
								$('.cboth').cornerz({radius:12, background:'#e9e8e4'})
								$('.cfoot').cornerz({radius:12, corners: 'bl br', background:'#545454'})
								$('.cbox').cornerz({radius:8, background:'white'})
								$('.info,.boatinfo,.film,.pricing').cornerz({radius:8, background:'white'})
								$('h3').cornerz({radius:8, background:'white'})
								$('tr.boats a').cornerz({radius:12, corners: 'tl tr', background:'white'})
								$('tr.book a').cornerz({radius:12, corners: 'bl br', background:'white'})
								$('.survey,.allfunky').cornerz({radius:8, background:'white'})
								$('.richdata').cornerz({radius:8, corners: 'tl bl br', background:'white'})
								$('.iimg,.filmstrip,.timg,.alert').cornerz({radius:8, background:'white'})
								$('.timg').cornerz({radius:8, background:'#f0f0f0'})
								$('.details,.book,.detailslight').cornerz({radius:12, background:'#f0f0f0'})
								$('.pic').cornerz({radius:8, background:'white'})
								$('.map').cornerz({radius:8, background:'white'})

								$('#compare').colorize({bgColor:'#f0f0f0',altColor:'#f7f7f7',hoverColor:'#edf6fb',hiliteColor:'#ddeef9',columns:'true'}) ;
								
								$('a[rel*=facebox]').facebox()
								$('.fav').jFav();

var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();

								$('#daterange').DatePicker({
								 flat: true,
								 date: curr_date+"-"+curr_month+"-"+curr_year,
									formatL: 'd/m/y',
								 calendars: 2,
								 mode: 'range',
								 starts: 0,
									onChange: function(formated, dates) {
									  $('#datesrange').val(formated);
									}
								});


});

$(document).ready(function() { 
var options = { 
 target: '#alert',
	clearForm: true
}; 
$('#contactForm').ajaxForm(options); 
}); 

$.fn.clearForm = function() {
  return this.each(function() {
	var type = this.type, tag = this.tagName.toLowerCase();
	if (tag == 'form')
	  return $(':input',this).clearForm();
	if (type == 'text' || type == 'password' || tag == 'textarea')
	  this.value = '';
	else if (type == 'checkbox' || type == 'radio')
	  this.checked = false;
	else if (tag == 'select')
	  this.selectedIndex = -1;
  });
};
