window.onload = function() {
if(document.getElementById("NavMark")){
	var underlineLink = document.getElementById("NavMark").getElementsByTagName("A");
	var lists = document.getElementById("NavMark").getElementsByTagName("UL");
	for (var i=0; i<underlineLink.length; i++) {
		var URL = window.location.href;
		var pageURL = underlineLink[i].toString();
		var pageURLHTML = pageURL.replace(".html","");

		if((URL.indexOf(pageURL)!= -1)||(URL.indexOf(pageURLHTML)!= -1) ){
			if(pageURL.indexOf('.') != -1) {
				underlineLink[i].className+=" underlineLink";
				underlineLink[i].parentNode.className+=" underlineLI";
				
			}
			else if(URL.lastIndexOf('/') == URL.length - 1)
				{
					underlineLink[i].className+=" underlineLink";
					underlineLink[i].parentNode.className+=" underlineLI";
				}
		}
	}
	var listNum="";
	for (var n=0; n<lists.length; n++) {
		listNum = n;
		listNum ="L"+listNum;
		lists[n].className+= listNum;
	}
}
}


function changeAction(){
	document.getElementById('siteSearch').action = document.getElementById('searchFor_Extra')[document.getElementById('searchFor_Extra').selectedIndex].value;
}

function OpenConstantContact(codeNum) { 
	var email = document.getElementById('emailsignup_ea').value;
	window.open('http://visitor.constantcontact.com/d.jsp?m=' + codeNum + '&p=oi&ea='+email);
	return false;
}

/* Text changer - light version.
Let your text's font size customizable.
by Marco Rosella - http://www.centralscrutinizer.it/en/design/js-php/text-changer
v0.2 - May 18, 2006

*/

var textChanger = {
	cpanel : 'textchanger',  //set here the id of the element (div, p) within you want to insert the control panel
	element : 'wrap',   	 //set here the id of the element (div, p) within you want to change the text
	defaultFS : 1,         //set here the default font size in 'em'

	init: function() {
		var cpel = document.getElementById(textChanger.cpanel);
		var el = document.getElementById(textChanger.element);
		if (cpel == null || el == null) {alert('The elements with the \"'+textChanger.cpanel+'\" and/or \"'+textChanger.element+'\" ID do not exist in HTML source.');} else {
		var u = document.createElement('ul');
		cpel.appendChild(u);
		u.innerHTML = 
		'<li id="decrease"><a href="#" title="Decrease font size">A</a></li>'+
		'<li id="reset"><a href="#" title="Default font size">A</a></li>'+
		'<li id="increase"><a href="#" title="Increase font size">A</a></li>'

		var sz = textChanger.getCookie();
		el.style.fontSize = sz ? sz + 'em' : textChanger.defaultFS + 'em';
		
		var incr = document.getElementById('increase');
		incr.onclick = function(){textChanger.changeSize(1); return false;};

		var decr = document.getElementById('decrease');
		decr.onclick = function(){textChanger.changeSize(-1); return false;};

		var reset= document.getElementById('reset');
		reset.onclick = function(){textChanger.changeSize(0); return false;};
		}
	} ,



	changeSize: function(val) {
		var el = document.getElementById(textChanger.element);
		var size = el.style.fontSize.substring(0,3);
		var fSize = parseFloat(size,10);

		if (val == 1) {
			fSize += 0.11;
			if (fSize > 2.0) fSize = 2.0;
		} 

		if (val == -1) {
			fSize -= 0.11;
			if (fSize < 0.5) fSize = 0.5;
		}		

		if (val == 0) {
			fSize = 1;
		}

		el.style.fontSize = fSize + 'em';
		textChanger.updateCookie(fSize);
		} ,

		

	updateCookie: function(vl) {
		var today1Cookie = new Date();
		var exp = new Date(today1Cookie.getTime() + (365*24*60*60*1000)); //the cookie will expire in one year  
		document.cookie = 'textChangerL=size=' + vl + ';' +'expires=' + exp.toGMTString() + ';' +'path=/';
	} ,

	getCookie: function() { 
		var cname = 'textChangerL=size=';	
		var start = document.cookie.indexOf(cname);
		var len = start + cname.length;

		if ((!start) && (cname != document.cookie.substring(0,cname.length))) {return null;}

		if (start == -1) return null;

		var end = document.cookie.indexOf(";",len);

		if (end == -1) end = document.cookie.length;

		return unescape(document.cookie.substring(len, end));
	}
}

function SocialTags(URL) { 
	var currentURL = window.location.href;

	if(URL=="http://www.facebook.com/share.php"){
		newWindow = window.open(URL + "?u="+currentURL + "&amp;title=");
	}
	else if(URL=="http://twitter.com/home"){
		 newWindow = window.open(URL + "?status="+currentURL + "&amp;title=");
	}
	else{
		 newWindow = window.open(URL + "?url="+currentURL + "&amp;title=");
	}
	
	if (window.focus) {newWindow.focus()}      
} 


function TOnly(){
	CSSLinks = document.getElementsByTagName('LINK');
	for (cnt = 0; cnt < CSSLinks.length; cnt++){
		if(CSSLinks[cnt].getAttribute("href") == "/css/style.css"){
			CSSLinks[cnt].setAttribute("href", "/css/text.css");
		}
		 else if(CSSLinks[cnt].getAttribute("href") == "/css/text.css"){
			CSSLinks[cnt].setAttribute("href", "/css/style.css");
		}
	}
}
	
function dateChangeForm(){
	document.getElementById("eventDate").value = document.getElementById("wedDay").value + '-' +(document.getElementById("wedMonth").selectedIndex +1)+ '-' + document.getElementById("wedYear")[document.getElementById("wedYear").selectedIndex].value;	
}

function updateEvent(cal)
{
	var date = document.getElementById("eventDate");
	var arr = date.value.split("-");
	var aday = document.getElementById("wedDay");
	var amonth = document.getElementById("wedMonth");
	var ayear = document.getElementById("wedYear");
	aday.value = parseInt(arr[0], 10);
	amonth.selectedIndex = parseInt(arr[1]-1, 10);
	ayear.value =parseInt(arr[2], 10);
	
}

function dateChangeForm2(){
	document.getElementById("eventDate2").value = document.getElementById("wedDay2").value + '-' +(document.getElementById("wedMonth2").selectedIndex +1)+ '-' + document.getElementById("wedYear2")[document.getElementById("wedYear2").selectedIndex].value;	
}

function updateEvent2(cal)
{
	var date = document.getElementById("eventDate2");
	var arr = date.value.split("-");
	var aday = document.getElementById("wedDay2");
	var amonth = document.getElementById("wedMonth2");
	var ayear = document.getElementById("wedYear2");
	aday.value = parseInt(arr[0], 10);
	amonth.selectedIndex = parseInt(arr[1]-1, 10);
	ayear.value =parseInt(arr[2], 10);
	
}

function dateChange(){
	document.getElementById("startDate2").value = document.getElementById("arrivald").value + '-' +(document.getElementById("arrivalM").selectedIndex +1)+ '-' + document.getElementById("arrivalY")[document.getElementById("arrivalY").selectedIndex].value;	
}

function updateStart(cal)
{
	var date = document.getElementById("startDate2");
	var arr = date.value.split("-");
	var aday = document.getElementById("arrivald");
	var amonth = document.getElementById("arrivalM");
	var ayear = document.getElementById("arrivalY");
	aday.value = parseInt(arr[0], 10);
	amonth.selectedIndex = parseInt(arr[1]-1, 10);
	ayear.value =parseInt(arr[2], 10);
	
}

/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

function populatedropdown(dayfield, monthfield, yearfield){
var today1 = new Date();

var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=0; i<31; i++){
	dayfield.options[i]=new Option(i+1, i+1)
}
dayfield.selectedIndex = (today1.getDate()-1);

for (var m=0; m<12; m++){
	monthfield.options[m]=new Option(monthtext[m], monthtext[m])
}
monthfield.selectedIndex = (today1.getMonth());

var thisyear=today1.getFullYear()
for (var y=0; y<20; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today1.getFullYear(), today1.getFullYear(), true, true) //select today1's year
}

	function makeDate(s, inChar, outChar){
		var newstring = s.split(inChar);
		newstring = newstring.join(outChar);
		return newstring;
	}
	

	function fixandsubmit(){
		var dtArrival;
		var d = document;
		var form = document.sform;
		
		if((!/^\d*$/.test(d.getElementById("rooms").value)) || (!/^\d*$/.test(d.getElementById("adults").value)) || (!/^\d*$/.test(d.getElementById("children").value))){
		alert("Rooms, Adults and children fields require a numeric value.");
		return false;
		}
	
		

		dtArrival= d.getElementById("arrivalY")[d.getElementById("arrivalY").selectedIndex].value+ '-' +d.getElementById("arrivalM")[d.getElementById("arrivalM").selectedIndex].value+ '-' + d.getElementById("arrivald").value;
		var da = new Date(makeDate(dtArrival, "-", "/"));
	
		d.getElementById("arrival").value = dtArrival; 
		d.getElementById("sform").action += d.getElementById("ChooseProperty").value;
		form.target="_blank";
		
		if(d.getElementById("ChooseProperty").selectedIndex==0){
			alert("Please select a hotel");
		}
		else{
			if(d.getElementById("promotioncode").value=="promo code"){
				d.getElementById("promotioncode").value="";
			}

			form.submit();
			d.getElementById("sform").action = "https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=FNSS&property=";
		}
	}


// gallery
function showPic(whichpic)
{
	if(document.getElementById)
	{
		var largepic = document.getElementById('placeholder');
		largepic.src = whichpic.href;
		largepic.alt = whichpic.title;
		document.getElementById('desc1').innerHTML= largepic.alt;
		
		return false;
	}
	else
	{
		return true;
	}
}
