function surfTo(form,select_name,scope) { 

   var myindex=form.elements[select_name.name].selectedIndex;
   
   if (form.elements[select_name.name].options[myindex].value != "0") {
   
      if (scope==0) {
         window.location=form.elements[select_name.name].options[myindex].value;
      } else if (scope==1) {
         top.location=form.elements[select_name.name].options[myindex].value;
      } else if (scope==2) {
         // Defining scope this way allows specific conditions to be met for certain pages in future
         window.open(form.elements[select_name.name].options[myindex].value,"","scrollbars,resizable,width=400,height=480");
      }
      
   }  
      
}

function MM_jumpMenu(targ,selObj,restore){ 
//v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); 
if (restore) selObj.selectedIndex=0; } 

 


<!-- Popup function -->

function PopUp(win_name,URL,width,height,scrollbars,menubar,resize){

if (scrollbars==null){

   scrollbars=0;

}

if (menubar==null){

   menubar="no"

}
if (resize==null){

   resize="no"

}

    open( URL,win_name, "width="+width+",height="+height+",status=0,toolbar=0,menubar="+menubar+",resizable="+resize+",location=0,scrollbars="+scrollbars+"");

}


<!-- rollover -->

var isIMG = document.images;

var Arrowon;

var Arrowoff;



if (isIMG) {

   Arrowon = new Image(5,8);

   Arrowon.src = "http://images.thisislondon.com/v2/have_your_say/til/img/std/navarrow_on.gif";

   Arrowoff = new Image(5,8);

   Arrowoff.src = "http://images.thisislondon.com/v2/have_your_say/til/img/std/navarrow_off.gif";

 }



function Arrow(Arrowname) {



   if (isIMG) {

     document[Arrowname].src = (document[Arrowname].src.indexOf('arrow_on.gif') != -1) ? 'http://images.thisislondon.com/v2/have_your_say/til/img/std/navarrow_off.gif' : 'http://images.thisislondon.com/v2/have_your_say/til/img/std/navarrow_on.gif';



   }



}





<!-- AA route planner submit -->

function submitForm()

{

document.routePlanner.submit();

}

function submitToConfirm()

{

document.routePlanner.action = "http://www.theaa.com/travelwatch/inc/planner_main_redirect.jsp?confirm=true";

document.routePlanner.submit();

}

function moreVias()

{

document.routePlanner.action = "http://www.theaa.com/travelwatch/planner_main.jsp";

var newVias = eval("2 + " + document.routePlanner.noOfVias.value);

document.routePlanner.noOfVias.value = newVias;

document.routePlanner.submit();

}

function checkContinentalEurope()

{

if(document.routePlanner.database.selectedIndex == 2)

{

document.routePlanner.avoidMotorWay.checked = false;

document.routePlanner.avoidMotorWay.disabled = true;

}

else

{

document.routePlanner.avoidMotorWay.disabled = false;

}

}

function setCheckBox()

{

if(document.routePlanner.database.selectedIndex == 2)

{

document.routePlanner.avoidMotorWay.checked = false;

document.routePlanner.avoidMotorWay.disabled = true;

}

}

<!-- To replace special characters in a string globally. Called in holiday planner-->

function callReplace(inText) 
{              

   var reg1 = new RegExp();
   var reg2 = new RegExp();
 
   reg1 = /\'/g ;
   reg2 = /\"/g ;

   
   OldAct1 = inText;
   OldAct2 = OldAct1.replace(reg1,'&rsquo;');
   OldAct3 = OldAct2.replace(reg2,'&quot;');		

   return OldAct3 ;

}

<!-- Date check format DD/MM/YYYY. Called in holiday planner -->

function checkDate(thisFormElement)
{ 
// for all other strange errors
   var err=0
   a  = thisFormElement.value
   b  = new Date(a)

   if (a!="") 
   {
      if (isNaN(b)) 
      {
         thisFormElement.focus();
         alert("Please enter a valid date in the format dd/mm/yyyy");
         return false;
      }

      else 
      {
      	 if (a.length != 10) err=1
         d = a.substring(0, 2)// day
         c = a.substring(2, 3)//''/''  
     	 b = a.substring(3, 5)// month
 	     e = a.substring(5, 6)//''/''  
	     f = a.substring(6, 10)// year
	  
        //basic error checking
	     if (b<1 || b>12) err = 1
	     if (c != "/") err = 1
	     if (d<1 || d>31) err = 1
	     if (e != "/") err = 1 
	     if (f<=0 || f>9999) err = 1
	  
        //advanced error checking
	    // months with 30 days
   	     if (b==4 || b==6 || b==9 || b==11)
         {
            if (d==31) err=1
         }
   	  
        // february, leap year
	     if (b==2)
         { 
           // feb 
           var g=parseInt(f/4)
           if (isNaN(g)) 
           {
              err=1 
           }

           if (d>29) err=1
           if (d==29 && ((f/4)!=parseInt(f/4))) err=1
         }

      	 if (err==1)
         {
            thisFormElement.focus();                     
            alert("Please enter a valid date in the format dd/mm/yyyy");
            thisFormElement.focus();                                      
            return false;
	     }
	     else
         {
           return true ;
         }
      }

   }

}


<!-- Compare two dates in the format DD/MM/YYYY. Called in holiday planner -->                     
                                          
function compareDates()                     
{
   inStart   = document.holidayForm.in_start_date.value ;
   inEnd     = document.holidayForm.in_end_date.value ;  
       
   var startday   = inStart.substring(0, 2);// day       
   var startmonth = inStart.substring(3, 5);// month        
   var startyear  = inStart.substring(6, 10);//year        
                
   var endday    = inEnd.substring(0, 2);// day    
   var endmonth  = inEnd.substring(3, 5);// month  
   var endyear   = inEnd.substring(6, 10);//year       
    	    	
   var startdate  = new Date(startyear-0,startmonth-1,startday-0);
   var enddate    = new Date(endyear-0,endmonth-1,endday-0);
       
   starttime = Date.UTC(startdate.getYear(),(startdate.getMonth()+1),startdate.getDate(),0,0,0);
   endtime   = Date.UTC(enddate.getYear(),(enddate.getMonth()+1),enddate.getDate(),0,0,0);        
        
     
   if (starttime > endtime)
   {
      alert("End Date should not be lesser than Start Date. Please check...");
      return false;
   }

   else
   {
        return true ;
   }
    
                    
}


<!-- called in holiday plan forms during submit -->                     

function checkFields()
{
   if (document.holidayForm.in_holiday_name.value=="")
   {
      alert("Please enter the holiday name");
   }

   else if (document.holidayForm.in_short_title.value=="")
   {
      alert("Please enter the Short Title ");
   }

   else if (document.holidayForm.in_destination_id.value=="")
   {
      alert("Please specify the destination. ");
   }
  

   else
   {
      
        document.holidayForm.action="saveplan.html";
        document.holidayForm.submit();
      
   }

}

<!-- Called in holiday planner to save the holiday notes -->

function callSaveNotes()
{
   document.inNotesForm.in_notes.value = callReplace(document.inNotesForm.in_notes.value);
   document.inNotesForm.submit();
}



<!-- Called in holiday planner to save the Emergency Info -->

function callSaveEmergency()
{
   if (document.emergencyForm.in_description.value=="") 
   {
       alert("Please enter the title");
   }

   else
   {
      document.emergencyForm.in_description.value = callReplace(document.emergencyForm.in_description.value);
      document.emergencyForm.in_value.value       = callReplace(document.emergencyForm.in_value.value);
      document.emergencyForm.action               = "save_emergency.html" ;
      document.emergencyForm.submit();
   }
}


<!-- Called in holiday planner to save the Todo lists -->

function callSaveToDo()
{

  if (document.todoForm.in_to_do_type.value=="")
   {
      alert("Please enter the to do item title... ");
   }

   else if (document.todoForm.in_description.value=="")
   {
      alert("Please enter the to do item... ");
   }


   else
   {
      
      document.todoForm.in_description.value = callReplace(document.todoForm.in_description.value);
      document.todoForm.in_to_do_type.value  = callReplace(document.todoForm.in_to_do_type.value);
      document.todoForm.action               = "save_todo.html" ;
      document.todoForm.submit();
   }
}


<!-- Called in holiday planner to delete holiday plan -->

function callDelete(inUser,inHolID) 
{
   if ( confirm("Are you sure you want to delete your Holiday Organiser for this holiday?")) 
   {
      document.location.href="delete.html?in_user_id="+inUser+"&in_holiday_id="+inHolID;
   }
}



<!-- Called in holiday planner to open My Itinerary page -->

function callMyItinerary(inUser,inHolID) 
{
   document.location.href="my_itinerary.html?in_user_id="+inUser+"&in_holiday_id="+inHolID;
}



<!-- Called in holiday planner to open Address lists -->

function callAddress(inUser,inHolID) 
{
   document.location.href="view_address.html?in_user_id="+inUser+"&in_holiday_id="+inHolID+"&in_new_flag=F";
}


<!-- Called in holiday planner to call the registration server to check the user name & password before opening Emergency Info page -->

function callDoEmergency(doc,inUser,inHolID)
{
   doc.action="http://128.129.18.49/register/travel.htm";
   doc.in_action.value="5";
   doc.in_success_action.value="45";
   doc.in_success_url.value="http://" +window.location.host+"/travel/registration/cookiemonster.html";
   doc.in_failure_url.value= document.URL;
   doc.in_failure_action.value="none";
   doc.in_redirect_url.value= "/travel/planner/view_emergency.html?in_user_id="+inUser+"&in_holiday_id="+inHolID+"&in_new_flag=N";
   doc.in_expire.value=getCookie("expire");
   doc.submit();
}



<!-- Called in holiday planner to save external URLs -->

 function callSaveURLS()
 {
    if ( (document.urlForm.in_description.value != "") && (document.urlForm.in_url.value !="") )
    {
      document.urlForm.in_description.value = callReplace(document.urlForm.in_description.value);
      document.urlForm.in_url.value         = callReplace(document.urlForm.in_url.value);
      document.urlForm.action               = "saveexternalurls.html" ;
      document.urlForm.submit();
    }
    
    else
    {
 	   alert("Please enter both description and URL");
    }

}

<!-- Date functions -->
Months=new Array()
Months[0]="January"
Months[1]="February"
Months[2]="March"
Months[3]="April"
Months[4]="May"
Months[5]="June"
Months[6]="July"
Months[7]="August"
Months[8]="September"
Months[9]="October"
Months[10]="November"
Months[11]="December"

function showDate()
{var dte=new Date();
var date=dte.getDate()
var month=Months[dte.getMonth()]
var year=dte.getFullYear();
var spc=" ";
var com=",";
if(date==1||date==21||date==31)
ender="st";
else if(date==2||date==22)
ender="nd";
else if(date==3||date==23)
ender="rd";
else
ender="th";
return(date+spc+month+spc+year);}
