function initLeftColumn() {
	if(document.getElementById('submitSearchLeftColumn')){
		/**
		 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
		 */
		// Declaring valid date character, minimum year and maximum year
		function isInteger(s){
			var i;
		    for (i = 0; i < s.length; i++){   
		        // Check that current character is number.
		        var c = s.charAt(i);
		        if (((c < "0") || (c > "9"))) return false;
		    }
		    // All characters are numbers.
		    return true;
		}
		
		function stripCharsInBag(s, bag){
			var i;
		    var returnString = "";
		    // Search through string's characters one by one.
		    // If character is not in bag, append to returnString.
		    for (i = 0; i < s.length; i++){   
		        var c = s.charAt(i);
		        if (bag.indexOf(c) == -1) returnString += c;
		    }
		    return returnString;
		}
		
		function validateInteger(type,obj){
			if(!isInteger(obj.value)){
				obj.value = 1 ;
			}
		}
		
		function validatePrice(type, obj){
			var value = obj.value * 1 ;
			if(!YAHOO.lang.isNumber(value)){
				obj.value = 0 ;
			} 
		}
		
		// Sets the maxdate of the startDate calendar if the endDate calendar was clicked or
		// if the startDate calendar is clicked the mindate of the endDate calendar is set. 
		function setSelectableDate(type,args,obj) {
			var selected = args[0];
		    var selectedDate = this._toDate(selected[0]) ;
		    /*selectedDate = YAHOO.widget.DateMath.clearTime(selectedDate) ;
			selectedDate = selectedDate.getDate() + '/' + (selectedDate.getMonth()+1) + '/' + selectedDate.getFullYear();*/
			var calendarId = obj.id ;
			if(calendarId == 'cal_searchDepartureDate'){
				var mindate = YAHOO.widget.DateMath.add(selectedDate,YAHOO.widget.DateMath.DAY, 1 );
				obj.cfg.setProperty('mindate', mindate);
			}
			if(calendarId == 'cal_searchArrivalDate'){
				var maxdate = YAHOO.widget.DateMath.subtract(selectedDate,YAHOO.widget.DateMath.DAY, 1 );
				obj.cfg.setProperty('maxdate', maxdate);
			}
			obj.render();	
		}
		
		function getDate(type,args,obj) {
			var selected = args[0];
		    var selectedDate = this._toDate(selected[0])
		    selectedDate = YAHOO.widget.DateMath.clearTime(selectedDate) ;
			selectedDate = selectedDate.getDate() + '/' + (selectedDate.getMonth()+1) + '/' + selectedDate.getFullYear();
			var calendarId = obj.id ;
			var inputId = calendarId.replace('cal_','');
			YAHOO.util.Dom.get(inputId).value = selectedDate ;
			if(YAHOO.util.Dom.get(inputId).onchange){
				YAHOO.util.Dom.get(inputId).onchange();
			}
			obj.hide() ;
		}
		var today = new Date();
		
		saC = new YAHOO.widget.Calendar("cal_searchArrivalDate","saCC",{  close:true });
		sdC = new YAHOO.widget.Calendar("cal_searchDepartureDate","sdCC",{  close:true }); 
		
		saC.cfg.setProperty('mindate', today);
		sdC.cfg.setProperty('mindate', today);
		
		saC.selectEvent.subscribe(getDate, saC, true); 
		sdC.selectEvent.subscribe(getDate, sdC, true);
		saC.selectEvent.subscribe(setSelectableDate, sdC, true); 
		sdC.selectEvent.subscribe(setSelectableDate, saC, true); 
		
		YAHOO.util.Event.addListener("searchArrivalDate", "click", saC.show, saC, true);
		YAHOO.util.Event.addListener("searchDepartureDate", "click", sdC.show, sdC, true);
		
		saC.render(); 
		sdC.render();
		
		YAHOO.util.Event.addListener("searchNumberOfAdults", "keypress", validateInteger, document.getElementById("searchNumberOfAdults") , true);
		YAHOO.util.Event.addListener("searchNumberOfRooms", "keypress", validateInteger, document.getElementById("searchNumberOfRooms"), true);
		YAHOO.util.Event.addListener("searchMaxPrice", "keypress", validatePrice, document.getElementById("searchMaxPrice") , true);
		YAHOO.util.Event.addListener("searchMinPrice", "keypress", validatePrice, document.getElementById("searchMinPrice"), true);  
		
	}
}

function popUp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=250,left = 410,top = 290');");
	}
function popUpWHTL(URL,width,height,left,top) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+width+",height="+height+",left = "+left+",top = "+top+"');");
	}
YAHOO.util.Event.addListener(window, "load", initLeftColumn); 

function ShareURL(nod) {

    var title = document.title;
    var url = document.location.href;
    var options = "height=436,width=626,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1";
    var mURL = '';
    if (nod == 1)
        mURL = "http://www.facebook.com/sharer.php?u=" + url + "&amp;title=" + title;
    if (nod == 2)
        mURL = "http://www.google.com/bookmarks/mark?op=edit&#38;bkmk=" + url + "&#38;title=" + title;
    if (nod == 3)
        mURL = "http://myweb2.search.yahoo.com/myresults/bookmarklet?&amp;u=" + url + "&amp;t=" + title;
    if (nod == 4)
        mURL = "http://www.mixx.com/submit/story?title=" + title + "&amp;page_url=" + url + "&amp;partner=Hizlial&amp;description=";
    if (nod == 5)
        mURL = "http://digg.com/submit?url=" + url + "&amp;title=" + title;
    if (nod == 6)
        mURL = "http://www.stumbleupon.com/submit?url=" + url + "&amp;title=" + title;
    if (nod == 7)
        mURL = "http://del.icio.us/post?url=" + url + "&amp;title=" + title;
    if (nod == 8)
        mURL = "http://reddit.com/submit?url=" + url + "&amp;title=" + title;
    if (nod == 9)
        mURL = "http://twshot.com/share.aspx?url=" + url + "&amp;title=" + title;
    if (nod == 10)
        mURL = "http://www.myspace.com/Modules/PostTo/Pages/?l=2&amp;u=" + url + "&amp;t=" + title + "&amp;c=" + title;
    if (nod == 11)
        mURL = "http://friendfeed.com/share/bookmarklet/frame#title=" + title + "&amp;url=" + url;
    window.open(mURL.replace(/amp;/gi, ''), '_blank', options);
}
