//Hide complex tariffs
jQuery(document).ready(function() {
	jQuery('div.mapcontainer').hide();
	jQuery("#hidemap").hide();
	jQuery("div.instructions").hide();
	jQuery('tr.rawhide').hide();
	jQuery('td.complex').hide();
	jQuery('#tariffentry').click(function() {
		jQuery("td.complex").toggle(jQuery('td.complex').css('display') == 'none');
		});
	jQuery('#showmap').click(function() {
		jQuery("div.mapcontainer").show();
		jQuery("#showmap").hide();
		jQuery("#hidemap").show();
		});
	jQuery('#hidemap').click(function() {
		jQuery("div.mapcontainer").hide();
		jQuery("#showmap").show();
		jQuery("#hidemap").hide();
		});
	jQuery('#showdisplay').click(function() {
		jQuery("div.instructions").show();
		jQuery("#showdisplay").hide();
		jQuery("#hidedisplay").show();
		});
	jQuery('#hidedisplay').click(function() {
		jQuery("div.instructions").hide();
		jQuery("#showdisplay").show();
		jQuery("#hidedisplay").hide();
		});
	});
	
function toggleComplex()
	{
	jQuery('td.complex').toggle();
	}
	
function displayMoreRates()
	{
	var id;
	
	var vlast			=	'xvalidto'+(start-1);
	var vfrom			=	'xvalidfrom'+start;
	var vto				=	'xvalidto'+start;
	var lastdate		=	document.getElementById(vlast).value;

	var mySplitResult 	= 	lastdate.split("/");
	var day				=	mySplitResult[0];
	var month			=	mySplitResult[1] - 1;
	var year			=	mySplitResult[2];				

	var nextDate 		= 	new Date(year,month,day);
	nextDate.setDate(nextDate.getDate()+1);

	day1				=	nextDate.getDate();
	if (day1 < 10)
		day1			=	'0'+day1;
	month1				=	nextDate.getMonth() + 1;
	if (month1 < 10)
		month1			=	'0'+month1;
	year1				=	nextDate.getFullYear();
	newDate				=	day1+'/'+month1+'/'+year1
	
	document.getElementById(vfrom).value	=	newDate;
	document.getElementById(vto).value	=	newDate;
	
	max = start+1;
	if (max > end)
		{
		jQuery('a.getmorerates').hide();
		max = end;
		}
	for (i=start;i < max;i++)
		{
		myid	=	'tr.raterow'+i;
		jQuery(myid).show();
		}
	start	=	i;
	}
	
function show_log1() {
	jQuery.get(ajaxurl+'&task=handlereq',{ field: 'show_log1'},
		function(data){
			eval(data);
			jQuery('div.block_ui_bookingform').unblock();
			}
	);
	//jQuery('div.block_ui_bookingform').unblock();
}
