




function displayDateAndTime(){


	Stamp = new Date();
	year = Stamp.getYear();

	if (year < 2000) year = 1900 + year;

	var Hours;
	var Mins;
	var Time;
	
	Hours = Stamp.getHours() -1;
	if (Hours >= 12) {
		Time = " P.M.";
	}
	else {
	Time = " A.M.";
	}
	if (Hours > 12) {
	Hours -= 12;
	}
	if (Hours == 0) {
	Hours = 12;
	}
	Mins = Stamp.getMinutes();
	if (Mins < 10) {
	Mins = "0" + Mins;

	}
	
	Time = Stamp.getDa() + Stamp.getDate() + "-"+ (Stamp.getMonth() + 1)  + "  " 	 + Hours + ":" + Mins + Time ;
	
	
}	
	
	
	
	
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");

function getthedate(){

	var mydate=new Date()
	var year=mydate.getYear()
	
	if (year < 1000)
		year+=1900
	
	var day=mydate.getDay()
	var month=mydate.getMonth()
	var daym=mydate.getDate()
	
	if (daym<10)
		daym="0"+daym
	
	var hours=mydate.getHours()
	var minutes=mydate.getMinutes()
	var seconds=mydate.getSeconds()
	var dn="AM"
	
	if (hours>=12)
		dn="PM"
		
		
	if (hours>12){
		hours=hours-12
	}
	
		
	if (hours==0)
	hours=12
	if (minutes<=9)
	minutes="0"+minutes
	if (seconds<=9)
	seconds="0"+seconds
	//change font size here
	var cdate="<small><font color='bbbbbb' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+hours+":"+minutes+":"+seconds+" "+dn
	+"</b></font></small>";
	
	 var divText = "<div id=\"calLine\">";

 	 divText += cdate;

	divText += "</div>";
	  divText+="<div id=\"calText\"   onclick=\"Javascript:showHide( 'calendarHolder' );\"> </div>";
	 

	
	
	if (document.all)
		
		document.all.topMenuBar.innerHTML=divText;
	
	else if (document.getElementById)
	
	  /*var div = document.getElementById("topMenuBar"); */
	  
	document.getElementById("topMenuBar").innerHTML="";
	document.getElementById("topMenuBar").innerHTML=divText;
	

	
	
		
	
}	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	function loadTimeAndDate(){
		
		if (document.all||document.getElementById)
			setInterval("getthedate()",1000)
	}



	
	
	
	
	
	
	
	
	
	/*document.getElementById('dateTime').innerHTML = Time;*/
	







function performHoverSubscribe( formElementName ){

	
	var formElement = document.getElementById( formElementName );
	
	formElement.focus();
	
	
	if ( 	( formElementName == 'fname'  &&  formElement.value== 'your name') |
			( formElementName == 'fsubemail'  &&  formElement.value== 'your email') |
			( formElementName == 'fsubtel'  &&  formElement.value== 'your postcode')	){
		
		formElement.value="";	
	
	}	
	
	


}


function revertTodefault( formElementName ){

	var defaultValue ="";

	// check the form element if nothing then revert back to original value 
	
	var formElement = document.getElementById( formElementName );
	

	if ( formElement.value == ""){
	
	
		if ( formElementName == 'fname'){
			defaultValue="your name";
		
		}
		else if ( formElementName == 'fsubemail'){
			defaultValue="your email";
		
		}
		else if ( formElementName == 'fsubtel'){
			defaultValue="your postcode";
		
		}
		
		
		formElement.value = defaultValue;		
	
	}
	
}










function ShowTop5( category  ){

	
  hideAllTop5();
  
  var top5HolderName; 
  var bgImageName;
   
  if ( category == "eatin" ){  
    top5HolderName = 'eatIn'; 
    
  }
  else if ( category == "eatout" ){ 
    top5HolderName = 'eatOut';   
   
  }
  /* else if ( category == "pcp" ){ 
    top5HolderName = 'pcb';   
    
  }*/
  
  if ( top5HolderName) {
    
    top5HolderName += "Top5";
    
    var top5Div = document.getElementById(top5HolderName);
    top5Div.style.display="block";   
  } 
  
}



function ShowFeatureText( divId  ){

  hideAllFeatureText();
  
  
    var featureTextDiv = document.getElementById(divId);
	
	if (featureTextDiv){
		featureTextDiv.style.display="block";   	
	}
	
    
 
  
}





function showHideListing( showHideDivName, listingHeaderDivName ){

  showHide( showHideDivName );
  
  var ele = document.getElementById( listingHeaderDivName );
  
  if (ele){
  
        
    if ( ele.style.backgroundPosition == '-58px 0px' || ele.style.backgroundPosition == '' ){
      ele.style.backgroundPosition='-41px 0px';
    }
    else{
      ele.style.backgroundPosition='-58px 0px';
    } 
    
  }
  
}

function showHide( divName ){
	
	var divvie = document.getElementById(divName);
  
  if (divvie){
  	
  	if (divvie.style.display == "none"){
  		divvie.style.display="block";  		
  	}
  	else{
      divvie.style.display="none";
  	}  
  }
  
}

function hideAllTop5( ){

  hide('eatInTop5');
  hide('eatOutTop5');
  /* hide('pcbTop5'); */
  
 
}

function hideAllFeatureText(){

	
	
  hide('foodText');
  hide('experienceText');
  hide('drinkText');
  hide('serviceText');
  hide('costText');
  hide('cuisineText');
  hide('introText');

}



function hide( formHolderName){
  
  var divvie = document.getElementById(formHolderName);
  
  if (divvie){
    divvie.style.display="none";
  }
}

function initAll(){
	
	YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
  
	
}

function initRestaurants(){
  

  //ShowTop5( 'eatout'  );
  //YAHOO.util.Event.onDOMReady(YAHOO.example.calendar.init);
  
  initCal();
  
  initAutoComplete();
  
  loadTimeAndDate();

    
  
}


var oDS ;
var oCS ;
var oAC ;
var oCC ;


function initAutoComplete(){


  if ( !oDS){
    // Use a LocalDataSource
    oDS = new YAHOO.util.LocalDataSource(YAHOO.example.Data.placeArray);
    // Optional to define fields for single-dimensional array
    oDS.responseSchema = {fields : ["state"]};

    // Instantiate the AutoComplete
    oAC = new YAHOO.widget.AutoComplete("what", "whatContainer", oDS);
    oAC.prehighlightClassName = "yui-ac-prehighlight";
    oAC.useShadow = true;
   }
    
     if ( !oCS){
    oCS = new YAHOO.util.LocalDataSource(YAHOO.example.Data.cityArray);
    // Optional to define fields for single-dimensional array
    oCS.responseSchema = {fields : ["state"]};

    // Instantiate the AutoComplete
    oCC = new YAHOO.widget.AutoComplete("where", "wherecontainer", oCS);
    oCC.prehighlightClassName = "yui-ac-prehighlight";
    oCC.useShadow = false;
    }
    
}    
   

    
    
    
    
    






function initCal(){
  

    YAHOO.namespace("example.calendar");
    YAHOO.example.calendar.cal1 = new YAHOO.widget.CalendarGroup("cal1","cal1Container", {PAGES:5});
    YAHOO.example.calendar.cal1.render();
    
  
  
  
}

function initContact(){
	
	ShowForm('recommendAPlace');
	ShowTop5( 'eatout'  );
	
	initAll();	

}


function changeListingPicture(restaurantName, imageDivName, imageNumber ){
	
	var directory= "images/listings/"
  if ( restaurantName == 'EatDrink' ){
  	 directory+= "eatdrink";
  	
  }	
  
  
  
  directory+= "/image" + imageNumber + ".jpg";
  
  divvie = document.getElementById(imageDivName);
  
  if (divvie){
  	divvie.style.backgroundImage = "url( " + directory + ")";
  }	
  

}

function openDirections( uri ){
	
	document.open(uri);
	
}

function openMenu( uri ){
  
  
}

function openListing( listingName ){

  location.href ="listings/exampleListing/listing.htm";

} 

function openMap( biz ){

  if ( biz == 'example'){
    
     window.open('http://www.multimap.com/maps/?qs=BR3+1BN&countryCode=GB','wcwindow','width=810,height=650, toolbar=yes, location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=no')
  }

}

function openMiniSite( biz ){

  if ( biz == 'example'){
     //location.replace("listings/exampleListing/listing.htm");
     location.href ="listings/exampleListing/listing.htm";
  }

}

function redirect( page ){

  if ( page == 'home'){
     //location.replace("listings/exampleListing/listing.htm");
     location.href ="http://www.eatlicious.com";
  }
  else if ( page == 'search'){
    location.href ="http://www.eatlicious.com/eatingout.htm";
  }
}


function ChangeAdvertiseTab( tabName ){
  
  hideAllAdvertiseTabs();
  
  var tabDiv = document.getElementById(tabName );
  
  if ( tabDiv ){
    tabDiv.style.display="block"; 
  
  }
  

}


function hideAllAdvertiseTabs(){

  hide('about')
  hide('mag');
  hide('website');
  hide('platinum');
  hide('gold');
  hide('silver');
  hide('bronze');
  hide('justweb');
  hide('contact');
  

}

function hide( tabName ){
  var tabDiv = document.getElementById(tabName );
  
  if ( tabDiv ){
    tabDiv.style.display="none"; 
  
  }

}


function rediectToExampleWebsite( package ){

  var uri  =  "http://www.eatlicious.com/listings/";
      uri +=  package ;
      uri += "/listing.htm";
  
  location.href = uri;     
      
  
  
  
    

}


function addBookMark( title ){


bookmarksite(location.href, title);



alert( title + ' has been added to your Favourites');



}


function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}



function openGetListed( ){

  location.href ="../contactus.htm";

} 

function openAdvertiseWithUs( ){

  location.href ="http://www.eatlicious.com/contactus.htm";

} 

function openReportInaccuracies( ){

  location.href ="http://www.eatlicious.com/contactus.htm";

} 

