﻿// JScript File
var mon=new Array(12);
        mon[0]="Jan";
        mon[1]="Feb";
        mon[2]="Mar";
        mon[3]="Apr";
        mon[4]="May";
        mon[5]="Jun";
        mon[6]="Jul";
        mon[7]="Aug";
        mon[8]="Sep";
        mon[9]="Oct";
        
        mon[10]="Nov";
        mon[11]="Dec";

function checkDate(sender,args)
    {
        var now=new Date();
        var today = new Date(now.getYear(), now.getMonth(), now.getDate()); 
        if (sender._selectedDate < today) 
        {
           alert("You cannot select check-in date earlier than today!");
           sender._selectedDate = new Date(); 
                // set the date back to the current date
            sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            var valid=new Date(sender._selectedDate);
            var d=new Date(valid.setDate(valid.getDate()+1));
            if(document.getElementById("txtCheckOut")!=null)
                document.getElementById("txtCheckOut").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();
        }
        else
        {
            var valid=new Date(sender._selectedDate);
            var d=new Date(valid.setDate(valid.getDate()+1));
            if(document.getElementById("txtCheckOut")!=null)
                document.getElementById("txtCheckOut").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();
        }
   }
   
function checkDate1(sender,args)
    {
        var da1=document.getElementById("txtCheckIn");
        var strDa1=da1.value.split("-");
        var da2=document.getElementById("txtCheckOut");
        var strDa2=da2.value.split("-");
        var i;
        var start;
        var end;
        for(i=0;i<12;i++)
        {
            if(mon[i]==strDa1[1])
            {
                start=i+1+"/"+strDa1[0]+"/"+strDa1[2]
            }
            if(mon[i]==strDa2[1])
            {
                end=i+1+"/"+strDa2[0]+"/"+strDa2[2]
            }
        }
        var date1=new Date(start);
        var date2=new Date(end);
        var day=Math.ceil((date2.getTime()-date1.getTime())/(1000*60*60*24));
        if(day>0)
        {
            var obj=document.getElementById('ddlNights');            
            obj.options[obj.selectedIndex].text=day;            
        }
        else
        {   
                date1=new Date(date1.getFullYear(),date1.getMonth(),date1.getDate()+1)
                alert('Check-Out date should be greater then check-in date');
                sender._selectedDate =date1
                 sender._textbox.set_Value(sender._selectedDate.format(sender._format))
        }
        
   }
   function SetCheckOut(obj)
   {
        var datePart=document.getElementById("txtCheckIn").value.split('-');
        var dateNew=datePart[1]+' '+datePart[0]+','+datePart[2];
        var valid=new Date(dateNew);
        var dd=parseInt(obj.options[obj.selectedIndex].value);
        var d=new Date(valid.setDate(eval(valid.getDate()+dd)));
        if(document.getElementById("txtCheckOut")!=null)
            document.getElementById("txtCheckOut").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();    
   }
   /*function for Apartment*/
   function checkDateA(sender,args)
    {
        var now=new Date();
        var today = new Date(now.getYear(), now.getMonth(), now.getDate()); 
        if (sender._selectedDate < today) 
        {
           alert("You cannot select check-in date earlier than today!");
           sender._selectedDate = new Date(); 
                // set the date back to the current date
            sender._textbox.set_Value(sender._selectedDate.format(sender._format))
            var valid=new Date(sender._selectedDate);
            var d=new Date(valid.setDate(valid.getDate()+1));
            if(document.getElementById("txtCheckOutA")!=null)
                document.getElementById("txtCheckOutA").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();
        }
        else
        {
            var valid=new Date(sender._selectedDate);
            var d=new Date(valid.setDate(valid.getDate()+1));
            if(document.getElementById("txtCheckOutA")!=null)
                document.getElementById("txtCheckOutA").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();
        }
   }
   
function checkDateA1(sender,args)
    {
        var da1=document.getElementById("txtCheckInA");
        var strDa1=da1.value.split("-");
        var da2=document.getElementById("txtCheckOutA");
        var strDa2=da2.value.split("-");
        var i;
        var start;
        var end;
        for(i=0;i<12;i++)
        {
            if(mon[i]==strDa1[1])
            {
                start=i+1+"/"+strDa1[0]+"/"+strDa1[2]
            }
            if(mon[i]==strDa2[1])
            {
                end=i+1+"/"+strDa2[0]+"/"+strDa2[2]
            }
        }
        var date1=new Date(start);
        var date2=new Date(end);
        var day=Math.ceil((date2.getTime()-date1.getTime())/(1000*60*60*24));
        if(day>0)
        {
            var obj=document.getElementById('ddlnightsA');            
            obj.options[obj.selectedIndex].text=day;            
        }
        else
        {   
                date1=new Date(date1.getFullYear(),date1.getMonth(),date1.getDate()+1)
                alert('Check-Out date should be greater then check-in date');
                sender._selectedDate =date1
                 sender._textbox.set_Value(sender._selectedDate.format(sender._format))
        }
        
   }
   function SetCheckOutA(obj)
   {
        var datePart=document.getElementById("txtCheckInA").value.split('-');
        var dateNew=datePart[1]+' '+datePart[0]+','+datePart[2];
        var valid=new Date(dateNew);
        var dd=parseInt(obj.options[obj.selectedIndex].value);
        var d=new Date(valid.setDate(eval(valid.getDate()+dd)));
        if(document.getElementById("txtCheckOutA")!=null)
            document.getElementById("txtCheckOutA").value=d.getDate()+"-"+mon[d.getMonth()]+"-"+d.getFullYear();    
   }
function checkDateT(sender,args)
{
    var now=new Date();
    var today = new Date(now.getYear(), now.getMonth(), now.getDate()); 
    if (sender._selectedDate < today) 
    {
       alert("You cannot select transfer date earlier than today!");
       sender._selectedDate = new Date(); 
            // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))            
    }        
}
function checkDateS(sender,args)
{
    var now=new Date();
    var today = new Date(now.getYear(), now.getMonth(), now.getDate()); 
    if (sender._selectedDate < today) 
    {
       alert("You cannot select service date earlier than today!");
       sender._selectedDate = new Date(); 
            // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))            
    }        
}

/*Example message arrays for the two demo scrollers*/

var pausecontent=new Array()
pausecontent[0]='<a href="#">Indiaoutbound.com awarded Best Implementation of Technology Programme<br /><br/>10 December 2008</a><br/><br/>Indiaoutbound.com recognised and awarded in the field of "Best Implementation of Technology Programme" by "Express & Galileo Travel World Awards- 2008" Also we have been runner up for the category of "Best Outbound Tour operator- North" '
pausecontent[1]='<a href="#">India Outbound at ATM Dubai 2008<br /><br/>21 March 2008</a><br/><br/>Fore Escapades , a fully integrated division of India Outbound , would now participate at the ATM Dubai fromt he 6th to 9th of May .2008 , the larget travel fair in the middle east . After a huge response at the ITB Berlin , we look forward to more business at the ATM. To take an appointment mail to Sameer Luthra at sales@indiaoutbound.com '
pausecontent[2]='<a href="#" target="_new">Indiaoutbound.com ties up with UAE Exchange<br /><br/>21 October 2008</a><br/><br/>India Outbound ties up with UAE Exchange, an exchange house based in the Middle East, primarily focusing on money transfer and Money Exchange. UAE is with more than 250 offices across India and has a very wide reach thus the centralised booking system would benefit them. The Interface software will be created for their systems which will help them to book all their travel needs. '

    
/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
function checktext()
			{
				var bb = document.getElementById("txtUserId");
				if(bb.value == '')
				{
					bb.value = "User Name";
				}
			}
			function checkpwd()
			{
				var p = document.getElementById("txtPwd");
				if(p.value == '')
				{
					p.value = "Password";
				}
			}
            function onloginload()
			{			    
			    var lu = document.getElementById("txtUserId");
			    lu.value = "User Name";
			    var lp = document.getElementById("txtPwd");		
			    lp.value = "Password";
			} 
			function EnableDisabel(obj,count)
			{
			    if(obj.options[obj.selectedIndex].text=='Double')
			    {
			        document.getElementById("Hotels_Room"+count+"_ddlChildAge").disabled=false;
			        document.getElementById("Hotels_Room"+count+"_ddlInfant").disabled=false;
			    }
			    else
			    {
			        document.getElementById("Hotels_Room"+count+"_ddlChildAge").disabled=true;
			        document.getElementById("Hotels_Room"+count+"_ddlInfant").disabled=true;
			    }
			}
			function Validation()
			{
									
				var c1 = document.getElementById("ddlCity");
				var c2=document.getElementById("ddlCountry");
				if(c1.options[c1.selectedIndex].text=='---Select One---')
				{
				    alert("Select city from the list");
                    c1.focus(); 
                    return false; 
				}
				if(c2.options[c2.selectedIndex].text=='---Select One---')
				{
				    alert("Select country from the list");
                    c2.focus(); 
                    return false; 
				}					
							
			    var c = document.getElementById("Hotels_ddlRoom1");
			    var i=2;
			    var flag=0;
			    while(c!=null)
			    {
			        if(c.options[c.selectedIndex].text!='-------Select Room-------')
			        {
			            flag=1;
			        }
			        c=document.getElementById("Hotels_ddlRoom"+i);
			        i=i+1;
			    }
			    if(flag==0)
			    {
			        alert("Select atleast one room type from the list");
                    return false; 
			    }														
				return true;				
			}
