/*var map;
var localSearch = new GlocalSearch();

var icon = new GIcon();
icon.image = "http://www.google.com/mapfiles/marker.png";
icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
icon.iconSize = new GSize(20, 34);
icon.shadowSize = new GSize(37, 34);
icon.iconAnchor = new GPoint(10, 34);


function usePointFromPostcode(postcode, callbackFunction) {
    localSearch.setSearchCompleteCallback(null, 
		function() {
			
			if (localSearch.results[0])
			{		
				var resultLat = localSearch.results[0].lat;
				var resultLng = localSearch.results[0].lng;
				var point = new GLatLng(resultLat,resultLng);
				callbackFunction(point);
				placeMarkerAtPoint(point);
			}else{
				
			}
		});	
		
	localSearch.execute(postcode + ", UK");
}

function placeMarkerAtPoint(point)
{
	var marker = new GMarker(point,icon);
	map.addOverlay(marker);
}

function setCenterToPoint(point)
{
	map.setCenter(point, 15);
}

function showPointLatLng(point)
{
	alert("Latitude: " + point.lat() + "\nLongitude: " + point.lng());
}

function mapLoad() {
if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		
		
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		var postcode=document.getElementById("address").value;
		usePointFromPostcode(postcode, setCenterToPoint);
		
	}
	
}
var browserName=navigator.appName;
function location1(pid)
{
	    disp_setting="toolbar=no,location=no,directories=no,menubar=no,";
		disp_setting+="scrollbars=no,width=450, height=400";
		window.open("http://houseofmoli.com/index.php?do=search&method=viewnew&id="+pid,"",disp_setting)
	    return false;
}*/

function change(url) {
   document.images['Main'].src=url;
   return false;
}


//==================mooving slide================================


  	for(var i = 0; i < myPix.length; i++) {
   		(myPix[i]);
	}

var thisPic = 0

function doPrevious() 
{    
if (document.images  && thisPic > 1)
    {
        thisPic--
        try{
             if(thisPic>2)
             {
			     //document.myPicture1.src='images/document/' + myPix[thisPic]+'.jpg'
//                 document.myPicture2.src='images/document/' +myPix[thisPic-1]+'.jpg'
//                 document.myPicture3.src='images/document/' +myPix[thisPic-2]+'.jpg'
//                 document.myPicture4.src='images/document/' +myPix[thisPic-3]+'.jpg'
				 if(myPix[thisPic-3])
			     {
                 document.myPicture1.src='thimg/' + myPix[thisPic]
				 change('images/document/' + myPix[thisPic]);
                 document.myPicture2.src='thimg/' +myPix[thisPic-1]
				 /**/
				 change('images/document/' + myPix[thisPic-1]);
                 document.myPicture3.src='thimg/' +myPix[thisPic-2]
				 /**/
				 change('images/document/' + myPix[thisPic-2]);
                 document.myPicture4.src='thimg/' +myPix[thisPic-3]
				 /**/
				 change('images/document/' + myPix[thisPic-3]);
				 
				 $("a1").href='images/document/'+ myPix[thisPic]
				 $("a2").href='images/document/'+ myPix[thisPic-1]
				 $("a3").href='images/document/'+ myPix[thisPic-2]
				 $("a4").href='images/document/'+ myPix[thisPic-3]
				 
                }
             }
         }
         catch(err)
         {
         
         }
     }
}

function doNext() 
{

	if (document.images && thisPic < 10) 
    {
			thisPic++
   //      document.myPicture1.src='images/document/' +myPix[thisPic]+'.jpg'
  //	   document.myPicture2.src='images/document/' +myPix[thisPic+1]+'.jpg'
 //        document.myPicture3.src='images/document/' +myPix[thisPic+2]+'.jpg'
//         document.myPicture4.src='images/document/' +myPix[thisPic+3]+'.jpg'
				
              if(myPix[thisPic+3])
			  {
			  document.myPicture1.src='thimg/' +myPix[thisPic]
			  change('images/document/' +myPix[thisPic]);
			  document.myPicture2.src='thimg/' +myPix[thisPic+1]
			  change('images/document/' +myPix[thisPic+1]);
              document.myPicture3.src='thimg/' +myPix[thisPic+2]
			  change('images/document/' +myPix[thisPic+2]);
              document.myPicture4.src='thimg/' +myPix[thisPic+3]
			  change('images/document/' +myPix[thisPic+3]);
			   /*alert(myPix[thisPic]);
			   alert(myPix[thisPic+1]);
			   alert(myPix[thisPic]);
			   alert(myPix[thisPic+3]);
			  */
			  $("a1").href='images/document/'+ myPix[thisPic]
              $("a2").href='images/document/'+ myPix[thisPic+1]
              $("a3").href='images/document/'+ myPix[thisPic+2]
              $("a4").href='images/document/'+ myPix[thisPic+3]
             }  
		}
	}

<!-- Function Written by imtiyaz-------------->
var step=1;
function slideit(){
	if (!document.images)
		return
	document.images.slide.src=eval("image"+step+".src")
	if (step<6)
		step++
	else
		step=1
	setTimeout("slideit()",2500)
}

<!-- End of Code written by IMT------->

/*function gtMap() 
	{ 
	 load();
	  addr = document.getElementById("address").value.toUpperCase();
	  if(addr) 
	  { 
		if(!getNAC(addr))
		{
		  alert("Address is not found!");
		}
	  }
	}*/
	
function trim(s)
{   var i;
	var returnString = "";
	for (i = 0; i < s.length; i++)
	{   
		var c = s.charAt(i);
		if (c != " ") returnString += c;
	}
	return returnString;
}

//-------------- Code added by IMTIYAZ ------------      -----

function chkform2()
{
		var dup = document.frm2.duplicate.value;
		if(dup)
		{
			alert( "The Property is already booked, Please try any other property");
			return false;
		}
}

//----------------- End of Code added by IMTIYAZ --------------------

function chkform1()
{
		var arrival2 = document.getElementById('arrival2').value;
		var departure2 = document.getElementById('departure2').value;
		var city = document.getElementById('city').value;
		var people =document.getElementById('people').value;
		var dup=document.getElementById('duplicate').value;
				
	    if(compareDates1(arrival2, departure2)== false)
		{
			return false;
		}
	    var dateRegEx = /^([0123]?\d)[\.\-\/\s]?([01]?\d)[\.\-\/\s]?(\d{4})$/;
		var result1 = arrival2.match(dateRegEx);
		var result2 = departure2.match(dateRegEx);
	
	
	
		if(arrival2 == '')	
		{
			alert( "Please Enter The Date Of Arrival Or CheckIn.");
			document.frm1.arrival2.focus();
			return false;
		}	
		
		if(departure2 == '')	
		{
			alert( "Please Enter The Date Of departure Or Check Out.");
			document.frm1.departure2.focus();
			return false;
		}
		
		if(arrival2!=''){
		
			var arrday = result1[1];
			var arrmonth = result1[2];
			var depmonth = result2[2];
			var arryear = result1[3];	
			var depyear = result2[3];	
			var depday = result2[1];
			
			
			if(arryear<=depyear){
			
				if(arrmonth==depmonth){
				
					if((depday - arrday < 3))
					{
							alert('Mininum stay is three days');							
							document.frm1.arrival2.focus();
							return false;
					}
				}
			}
			
			if(arryear==depyear){			
				if(arrmonth>depmonth){					
					alert("Arrival month should not be greater than departure month");
					document.frm1.arrival2.focus();
					return false;
					
				}
			}
			
			if(arryear>depyear){
								
				alert("Arrival year should not be greater than departure year");
				document.frm1.arrival2.focus();
				return false;
				
			}
			
			
			HoldDate=new Date();
			var to_day = HoldDate.getDate(); 
			var to_month = (HoldDate.getMonth()+1);
			var to_year = HoldDate.getYear();
	
			
	}
		
	if(people == '-1')	
		{
			alert("Please specify number of guests.");
			document.frm1.people.focus();
			return false;
		}
		
		if(result1 == null){
			alert("Please Enter The Correct Format Of Date In 'dd-mm-yyyy'");
			document.frm1.arrival2.focus();
			return false;	
		}
		
		if(result2 == null){
			alert("Please Enter The Correct Format Of Date In 'dd-mm-yyyy' Of departure.");
			document.frm1.departure2.focus();
			return false	
		}
	
}

function compareDates1(dt1, dt2){
	
		var dateRegEx = /^([0123]?\d)[\.\-\/\s]?([01]?\d)[\.\-\/\s]?(\d{4})$/;
		var result1 = dt1.match(dateRegEx);
		var result2 = dt2.match(dateRegEx);	
	    if(result1 && result2)
		{
		var arrday = result1[1];
		var arrmonth = result1[2];
		var arryear = result1[3];	
		var depday = result2[1];
	    var depmonth = result2[2];
	    var depyear = result2[3];
		var dif = 0;
		dif += (depmonth - arrmonth);		
		dif += ((depyear - arryear) * 12);	
		
		if((depday - arrday < 0) && (dif <= 0)){		
		
			alert("The Date Of Departure Must Be Date after three days of Arrival.");
			document.frm1.arrival2.focus();
			return false;
		
		}
		
	}
}


function checkDate1() 
	{	
		var arrival_val 		= document.getElementById('arrival2').value;
		var mySplitResult 		= arrival_val.split(".");
		var mySplitResultDay 	= mySplitResult[0];
		var mySplitResultMonth 	= mySplitResult[1];
		var mySplitResultYear 	= mySplitResult[2];
		var mySplitResultMonth 	= parseInt(mySplitResultMonth - 1);		
		
		var currentDate = new Date();
		var currentDateWithoutTime = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()).format('dd.MM.yyyy');
		var currentDateWithoutTimeDep = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+3).format('dd.MM.yyyy');				
		
		var myDate=new Date();
		myDate.setFullYear(mySplitResultYear,mySplitResultMonth,mySplitResultDay);
		var today = new Date();
				
		if (myDate<today)
		  {
		    var newValtest = new Date(mySplitResultYear, mySplitResultMonth, mySplitResultDay).format('dd.MM.yyyy');
			alert('Select a date after Current date');
			document.getElementById('arrival2').value  =  currentDateWithoutTime;
			document.getElementById('departure2').value  =  currentDateWithoutTimeDep; 
			return false;
		  }
		else
		  {
		 	mySplitResultDay = parseInt(mySplitResultDay, 10) + 3;	
			var newVal = new Date(mySplitResultYear, mySplitResultMonth, mySplitResultDay).format('dd.MM.yyyy');			
			document.getElementById('departure2').value  =  newVal;
			return false;
		  }
	}
	
	function checkOutDate1() 
	{	
		var departure_val 		= document.getElementById('departure2').value;
		var mySplitResult 		= departure_val.split(".");
		var mySplitResultDay 	= mySplitResult[0];
		var mySplitResultMonth 	= mySplitResult[1];
		var mySplitResultYear 	= mySplitResult[2];
		var mySplitResultMonth 	= parseInt(mySplitResultMonth - 1);
		
		
		var arrival_val 			= document.getElementById('arrival2').value;
		var mySplitResult1 			= arrival_val.split(".");
		var mySplitResultDay1 		= mySplitResult1[0];
		var mySplitResultMonth1 	= mySplitResult1[1];
		var mySplitResultYear1 		= mySplitResult1[2];
		var mySplitResultMonth1 	= parseInt(mySplitResultMonth1 - 1);	
		var mySplitResultDay1 		= parseInt(mySplitResultDay1, 10) + 3;
		
		var currentDate = new Date();
		var currentDateWithoutTimeDep = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+3).format('dd.MM.yyyy');	
				
		
		var myDate=new Date();
		var newDate=new Date();
		myDate.setFullYear(mySplitResultYear, mySplitResultMonth, mySplitResultDay);
		newDate.setFullYear(mySplitResultYear1, mySplitResultMonth1, mySplitResultDay1);
		var today = new Date();
				
		
		  if (myDate<newDate)
		  {
		    var newValtest = new Date(mySplitResultYear1, mySplitResultMonth1, mySplitResultDay1).format('dd.MM.yyyy');
			alert('Select a date after three days of arrival date');		
			document.getElementById('departure2').value  =  newValtest; 
			return false;
		  }
		 if (myDate<today)
		  {
			alert('Select a date after Current date');
			document.getElementById('departure2').value  =  currentDateWithoutTimeDep; 
			return false;
		  }
		  	

	}
