$(document).ready(function(){
//Set opacity on each span to 0%


$('.shader').hover(
    function() {
        $(this).stop().fadeTo(500, 0.7);
    },
    function() {
		$(this).stop().fadeTo(500, 1);
    }
)

// setup the datepickers. 

	$(function() {
			$( "#cid" ).datepicker( {dateFormat: "dd-mm-yy"} );  //( "option", "dateFormat", $( this ).val() );
	});
	$(function() {
			$( "#cod" ).datepicker( {dateFormat: "dd-mm-yy"} );
	});

$('.ani').hover(
    function() {
        $(this).stop().fadeTo(500, 0.7);
    },
    function() {
		$(this).stop().fadeTo(500, 1);
    }
)


});

function SetUpValues()
{
	// get entry fields
	var goDate 		= $('#goDate').value;
	var backDate 	= $('backDate').value;
	
	//break up entry fields
	$('inday').value = goDate.substring(0,2);
	$('inmonth').value = goDate.substring(3,5);
	$('outday').value = backDate.substring(0,2);
	$('outmonth').value = backDate.substring(3,5);  
		
	document.DatesForm.submit();
}

function submitToBookAssist() {

	// Make sure hotel_id,  guide_id and service_model are present. Add hotel_group if its required.
	var link_page = 'http://www.bookassist.com/conduit/c_1.jsp?hotel_id=1074&service_model=2&guide_id=2&ca=left&cv=top&dw=750';
	
	var paremetersToPickUp = new Array('inday', 'inmonth',
		'outday', 'outmonth', 'user_language', 'r', 'price_group','adults', 'children');
	
	var s = top.location.search;
	


	for(i=0; i<paremetersToPickUp.length; i++) {
		//alert(paremetersToPickUp[i]);
		//var paramRegex = /hotel_id=([^&]*)/;
		var paramRegex = new RegExp(paremetersToPickUp[i]+"=([^&]*)");
		found = s.match(paramRegex);
		if(found) {
			if(found.length>1) {
				link_page = link_page + '&' + paremetersToPickUp[i] + '=' +  found[1];
			}
		}
	}
	self.location.href=link_page;
}
