function fadeIn(id, millisec, startOpacity, endOpacity){
	if(!startOpacity) startOpacity = 0;
	if(!endOpacity) endOpacity = 1;
	dojo.fadeIn({
		node: id,
		start:startOpacity,
		end:endOpacity,
		duration: millisec,
		beforeBegin: function() {
			var node = dojo.byId(id);
			dojo.style(node, "opacity", startOpacity);
			dojo.style(node, "display", "");
		}
	}).play();
	return true;
}
var popUpWin=0;



function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
  		if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function fadeOut(id, millisec, endOpacity, startOpacity){
	if(!endOpacity) endOpacity = 0;
	if(!startOpacity) startOpacity = 1;
	dojo.fadeOut({
		start:startOpacity,
		end:endOpacity,
		node: id,
		duration: millisec
	}).play();
	if(endOpacity==0) setTimeout("hideElement('"+id+"')", millisec);
	return true;
}

function SearchAllOn(elementCategory){
	document.getElementById('SearchAll'+elementCategory).checked = true;
	for(i=0; document.getElementById(elementCategory+i); i++){
		document.getElementById(elementCategory+i).checked = false;
	}
}

function SearchAllOff(elementCategory){
	document.getElementById('SearchAll'+elementCategory).checked = false;
}

function checkDateOf(field) {
	var datere = new RegExp("^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$");
	if(!datere.test(field.value) && field.value!="") {
		alert("Your arrival date needs to match the format: MM/DD/YYYY\n");
		return false;
	}
}


var existingMarkers = new Array();
var currentGGLMarkers = new Array();

function tripPlannerTabSwitch(tabID){
	tabs = new Array('tripPlannerSearchResults', 'tripPlannerMyTripPlanner', 'tripPlannerTips');
	for(i=0; tabs[i]; i++){
		if(tabID==tabs[i]){
			document.getElementById(tabs[i]+'Tab').className = 'tripPlannerTabOn';
			showElement(tabs[i]);
		}
		else{
			document.getElementById(tabs[i]+'Tab').className = 'tripPlannerTabOff';
			hideElement(tabs[i]);
		}
	}
	return true;
}


function tripPlannerDialogue(s){
	document.getElementById('tpDialogue').style.visibility = 'visible';
	document.getElementById('tpDialogue').innerHTML=s+'<br clear="all" /><div align="center"><button onclick="closetripPlannerDialogue();">CLOSE</button></div>';
}

function closetripPlannerDialogue(){
	document.getElementById('tpDialogue').style.visibility = 'hidden';
	document.getElementById('tpDialogue').innerHTML='';
}

function addToTripPlanner(theID,theCAT,hideElementID,showElementID) {
	dojo.xhrGet( {
		url: "http://www.visitithaca.com/tripplanner/includes/addItemToTripPlanner.php?add=true&id="+theID+"&category="+theCAT, 
		handleAs: "text",
		timeout: 5000,
			// The LOAD function will be called on a successful response.
		load: function(response, ioArgs) {
			//dojo.byId("tripPlannerNotification").innerHTML = response;
			if(document.getElementById(hideElementID)) setTimeout("fadeOut('"+hideElementID+"', 500)", 0);
			if(document.getElementById(hideElementID)) setTimeout("hideElement('"+hideElementID+"')", 600);
			if(document.getElementById(showElementID)) setTimeout("fadeIn('"+showElementID+"', 500)", 600);
			return response;
		},
			// The ERROR function will be called in an error case.
		error: function(response, ioArgs) {
			alert('There was an error.\n'+response);
			return response;
		}
	});
}


function removeFromTripPlanner(theID,theCAT,hideElementID,showElementID){
	
	dojo.xhrGet( {
		url: "http://www.visitithaca.com/tripplanner/includes/removeItemFromTripPlanner.php?remove=true&id="+theID+"&category="+theCAT, 
		handleAs: "text",
		timeout: 5000,
			// The LOAD function will be called on a successful response.
		load: function(response, ioArgs) {
			if(document.getElementById(hideElementID)) setTimeout("fadeOut('"+hideElementID+"', 500)", 0);
			if(document.getElementById(hideElementID)) setTimeout("hideElement('"+hideElementID+"')", 600);
			if(document.getElementById(showElementID)) setTimeout("fadeIn('"+showElementID+"', 500)", 600);
			return response;
		},
			// The ERROR function will be called in an error case.
		error: function(response, ioArgs) {
			alert('There was an error.\n'+response);
			return response;
		}
	});
}

function createMarker(theID, theCAT, latitude, longitude, count, name, contactInfo,isTPItem,imagePath,fullDetailsURL){
	
	var iconArray = new Array();
	
	var icon = new GIcon(baseIcon);
	icon.image = 'http://www.visitithaca.com/tripplanner/images/icons/'+theCAT+count+'.gif';
    icon.infoWindowAnchor = new GPoint(21,63);

	var point = new GLatLng(latitude,longitude);

	var marker = new GMarker(point,icon);
	map.addOverlay(marker);
	existingMarkers[existingMarkers.length] = theID+''+theCAT; // add to existing markers array
	currentGGLMarkers[currentGGLMarkers.length] = new GLatLng(latitude,longitude); // store map point object so we can recenter the map
	GEvent.addListener(marker, "click", function(){
					 openListingWindow(theID, theCAT, latitude, longitude,name,imagePath,contactInfo,isTPItem,fullDetailsURL);});//end of event handler

}


function openListingWindow(theID, theCAT, latitude, longitude,item_name,image,contactHTML,isTPItem,fullDetailsURL){

	var point = new GLatLng(latitude,longitude);
	
	//trim lat/lon
	latitude = new String(latitude).slice(0,7);
	longitude = new String(longitude).slice(0,8); //catch the "-"
	
	
	if(image != ''){
		var htmlStr = '<span class="bubbleText"><img src="'+image+'" hspace="2" style="margin-bottom:2px;" align="left"><b>'+item_name+'</b><br />('+latitude+','+longitude+')<br />'+contactHTML+'<br clear="all" />';
	}
	else{
		var htmlStr = '<span class="bubbleText"><b>'+item_name+'</b><br />('+latitude+','+longitude+')<br />'+contactHTML;
	}
	  
	  
		//add the directions form
	htmlStr = htmlStr+'<p><form action="http://maps.google.com/maps" method="get" target="_blank">For a map &amp; driving directions to this site,<br /> enter your starting address here:<br /><input name="saddr" type="text" id="saddr" style="width:160px; height:15px;"> <input type="submit" value="GO" style="height:20px; width:25px; font-size:10px;"><input type="hidden" name="daddr" value="'+latitude+' '+longitude+'"><input type="hidden" name="hl" value="en"></form>';
	
		//add full details link
	if(fullDetailsURL){
		htmlStr = htmlStr+'<p><a href="javascript:void(0);" onclick="fullDetailsWindow(\''+fullDetailsURL+'\');" style="color:#333333;">full details</a>';
	}

		//add details, zoom to street
	htmlStr = htmlStr+'<p><a href="javascript:void(0);" onclick="zoomToStreet('+longitude+','+latitude+');" style="color:#333333;">zoom to street level</a>';
	
	 	//add a TP add/remove links
	if(isTPItem) { //provide remove link
		htmlStr = htmlStr+'<br /><a href="javascript:void(0);" onclick="removeFromTripPlanner(\''+theID+'\',\''+theCAT+'\');" style="color:#333333;">remove from trip planner</a>';
	}
	else {
		htmlStr = htmlStr+'<br /><a href="javascript:void(0);" onclick="addToTripPlanner(\''+theID+'\',\''+theCAT+'\');" style="color:#333333;">add to trip planner</a>';
	}

	htmlStr = htmlStr+"</span>";

	map.openInfoWindowHtml(point, htmlStr);
	map.setCenter(point);
    
    
}

function centerMapOnPoint(latitude,longitude){
	var point = new GLatLng(latitude,longitude);
	map.setCenter(point);
}


function zoomToBestView(){
	if(currentGGLMarkers.length){
		var minLat = 90;
		var maxLat = -90;
		var minLon = 180;
		var maxLon = -180;
		
		for(var k=0; k < currentGGLMarkers.length;k++)
		{
			if(parseFloat(currentGGLMarkers[k].lat()) < parseFloat(minLat)){minLat = currentGGLMarkers[k].lat();}
			if(parseFloat(currentGGLMarkers[k].lat()) > parseFloat(maxLat)){maxLat = currentGGLMarkers[k].lat();}
			if(parseFloat(currentGGLMarkers[k].lng()) < parseFloat(minLon)){minLon = currentGGLMarkers[k].lng();}
			if(parseFloat(currentGGLMarkers[k].lng()) > parseFloat(maxLon)){maxLon = currentGGLMarkers[k].lng();}
		}
		//alert(minLat + ' ' + minLon + ' ' + maxLat + ' ' + maxLon);
		var GLLBounds = new GLatLngBounds(new GLatLng(minLat,minLon),new GLatLng(maxLat,maxLon));
		//alert(GLLBounds);
		zoomLevel = parseInt(map.getBoundsZoomLevel(GLLBounds))-1;
		if(zoomLevel<1) zoomLevel = 1;
		map.setCenter(GLLBounds.getCenter(),zoomLevel);
		
	}
	
}


function zoomToStreet(longitude,latitude){
	var point = new GLatLng(latitude,longitude);
	map.setCenter(point,16);
}

function fullDetailsWindow(url){
	openTripPlannerWindow = open(url, 'tripPlannerDetailsWin', 'toolbar=no,location=no,directories=no,status=1,menubar=no,scrollbars=1,resizable=1,copyhistory=yes,width=600,height=400');
	openTripPlannerWindow.focus();
}
function saveTempLocation(point){
	map.setCenter(point) ;
	if(saveLocationIcon != ''){
		map.removeOverlay(saveLocationIcon);
	}
	
	var marker = new GMarker(point, icon);
 	
	GEvent.addListener(marker, "click", saveLocation);
	map.addOverlay(marker);
	saveLocationIcon = marker;
 }

function saveLocation()
{	
	var center = map.getCenter();
	
	//test for fields, catch errors
	try{
		opener.document.getElementById("flott-latitude").value =  center.lat();
		opener.document.getElementById("flott-longitude").value =  center.lng();
	}
	catch(e)
	{
		opener.document.getElementById("flott-lati").value =  center.lat();
		opener.document.getElementById("flott-longi").value =  center.lng();
	}
	//opener.document.forms[0].flott-longitude.value = center.lng();
	close();
}
if(isdefined('GMap2')){
	//-------------------------------------------------------------------------------------------	
	 var map = new GMap2(document.getElementById("map")); 
	 map.addControl(new GLargeMapControl());
	 var point = new GLatLng(42.44466216519197,-76.49928331375122);
	 map.setCenter(point,10);
	//-------------------------------------------------------------------------------------------
	// Create our "click" marker icon
	var icon = new GIcon();
	icon.image = "http://www.visitithaca.com/i/map-save-this-location.gif";
	icon.iconSize = new GSize(129, 32);
	icon.iconAnchor = new GPoint(8, 32);
	
	var saveLocationIcon = "";

	GEvent.addListener(map, 'click', function(overlay, point){
		if(typeof overlay == "undefined" || overlay== null){ //only check if the save marker was NOT clicked
			saveTempLocation(point);
		}
 	});
}
var popUpWin = 0;
function popLocationSelectPage(){
	var width = 800;
	var height = 600;
	var left = 10;
	var top = 10;
	if(popUpWin){
		if(!popUpWin.closed) popUpWin.close();
	}
	if(document.getElementById("flott-lati")){
		currentLatitude = document.getElementById("flott-lati").value;
		currentLongitude = document.getElementById("flott-longi").value;
	}
	else{
		currentLatitude = document.getElementById("flott-latitude").value;
		currentLongitude = document.getElementById("flott-longitude").value;
	}
		// should be in the admin directory
	popUpWin = open('http://www.visitithaca.com/admin/chooseLocationGoogle.php?latitude='+currentLatitude+'&longitude='+currentLongitude, 'popUpWin', 'toolbar=no,location=no,directories=no,status=1,menubar=no,scrollbars=1,resizable=1,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function isdefined(variable){
    return (typeof(window[variable]) == "undefined")?  false: true;
}

document.onmousemove = getMouseCoordinates;

function getMouseCoordinates(event){
	ev = event || window.event;
	mouseX = ev.pageX;
	mouseY = ev.pageY;
}

//either shows or hides an element based on its current status
function showHideElement(elementId){
	if(document.getElementById(elementId).style.display=='none'){
		document.getElementById(elementId).style.display = '';
	}
	else{
		document.getElementById(elementId).style.display = 'none';
	}
}

function showHideParentElement(elementId){

	if(!parent.document.getElementById(elementId)){
		return false;
	}
	if(parent.document.getElementById(elementId) && parent.document.getElementById(elementId).style.display=='none'){
		parent.document.getElementById(elementId).style.display = '';
		return true;
	}
	if(parent.document.getElementById(elementId)){
		parent.document.getElementById(elementId).style.display = 'none';
		return true;
	}
	if(opener.document.getElementById(elementId) && opener.document.getElementById(elementId).style.display=='none'){
		opener.document.getElementById(elementId).style.display = '';
		return true;
	}
	if(opener.document.getElementById(elementId)){
		opener.document.getElementById(elementId).style.display = 'none';
		return true;
	}
}

function hideElement(elementId){
	if(document.getElementById(elementId)){
		document.getElementById(elementId).style.display = 'none';
	}
}

function showElement(elementId){
	if(document.getElementById(elementId)){
		document.getElementById(elementId).style.display = '';
	}
}

function changeHTML(elementId, str){
    document.getElementById(elementId).innerHTML = str;
}

function positionItAtMouse(elementID){
	//define universal dsoc left point
	var dsocleft = document.body.scrollLeft;
	//define universal dsoc top point
	var dsoctop = document.body.scrollTop;

	//if the user is using IE 4+ or Firefox/ NS6+
	if (document.all||document.getElementById){
		if(document.getElementById(elementID)){
			document.getElementById(elementID).style.left=parseInt(mouseX)+5+"px";
			document.getElementById(elementID).style.top=mouseY+5+"px";
		}
	}
}

function xmlhttpPost(strURL, formId, updateElementId, loadingElement, doNotHide){
	if(!doNotHide){
		hideElement(updateElementId);
		showElement(loadingElement);
	}
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatePageHTML(updateElementId, self.xmlHttpReq.responseText);
			if(!doNotHide){
				hideElement(loadingElement);
				showElement(updateElementId);
			}
        }
    }
    self.xmlHttpReq.send(getquerystring(formId));
}

function getquerystring(formId) {
	qstr = '';
	var obj = document.forms[formId]
	for (i=0; obj.elements[i]; i++) {
		currentElement = obj.elements[i].name;
		currentValue = obj.elements[i].value;
    	qstr = qstr + currentElement + '=' + escape(currentValue) + '&';  // NOTE: no '?' before querystring
	}
    return qstr;
}

function updatePageHTML(elementId, str){
    document.getElementById(elementId).innerHTML = str;
}

function validateString(element){
      
    stringType = element.substr(0, 4);
	if(!document.getElementById(element)){
		return false;
	}
    stringToTest = document.getElementById(element).value;
	re = /^$/;
	canBeEmpty = element.substr(4,1);
	if(canBeEmpty=='t'){
		canBeEmpty = true;
	}
	else if(canBeEmpty=='f'){
		canBeEmpty = false;
	}
	if(canBeEmpty==true && stringToTest==''){
		if(document.getElementById(element+'_valid_image')){
			document.getElementById(element+'_valid_image').src = 'http://www.visitithaca.com/admin/themes/Default/images/form_valid.gif';
		}
		return true;
	}
if(stringType=='blnk'){re = /.$/;}
if(stringType=='date'){re = /^([01]){1,1}([0-9]){1,1}\/([0-3]){1,1}([0-9]){1,1}\/([0-9]){4,4}$/;}
if(stringType=='emal'){re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;}
if(stringType=='flot'){re = /^\-{0,1}[0-9]{1,32}[\.]{0,1}[0-9]{0,32}$/;}
if(stringType=='gtxt'){re = /^[\nA-Za-z0-9\ \.\-_\(\)\,&!\?\:\;\\'\/\#\$\%\^\*"\@\|]+$/;}
if(stringType=='htxt'){re = /^[\nA-Za-z0-9\ \.\-_\(\)\,&!\?\:\;\\'\/\#\$\%\^\*"\<\>\/\=@]+$/;}
if(stringType=='keyp'){re = /^[A-Za-z0-9\ \.\-_\(\)\,&!\?]+$/;}
if(stringType=='link'){re = /^(?:(?:ftp|https?):\/\/){0,1}(?:[a-zA-Z0-9](?:[-a-zA-Z0-9]*[a-zA-Z0-9])?\.)+(?:com|edu|biz|org|gov|int|info|mil|net|name|museum|coop|aero|mobi|tv|us|[a-zA-Z][a-zA-Z])\b(?:\d+)?(?:\/[^;"\'<>()\[\]{}\s\x7f-\xff]*(?:[.,?]+[^;"\'<>()\[\]{}\s\x7f-\xff]+)*)?/;}
if(stringType=='ltxt'){re = /^[A-Za-z0-9\ \.\-_\(\)\,&!\?\'\/\;]+$/;}
if(stringType=='mdes'){re = /^[A-Za-z0-9\ \.\-_\(\)\,&!\?]+$/;}
if(stringType=='name'){re = /^([a-zA-Z0-9\ \-\,\.\(\)\/\:\\\']){1,64}$/;}
if(stringType=='numb'){re = /^\-{0,1}([0-9]+)$/;}
if(stringType=='pass'){re = /^.*(?=.{6,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/;}
if(stringType=='phon'){re = /^([\S\s]{1,50})$/;}
if(stringType=='ptle'){re = /^[A-Za-z0-9\ \.\-_\(\)\,&!\?\'\;]{3,255}$/;}
if(stringType=='seas'){re = /(winter|summer|spring|fall){1,}$/;}
if(stringType=='spas'){re = /^([\S]{6,32})$/;}
if(stringType=='stxt'){re = /[^"&<>]/;}
if(stringType=='user'){re = /^[a-zA-Z0-9]{4,32}$/;}
if(stringType=='zipc'){re = /^[A-Za-z0-9\-\ ]{5,20}$/;}
	goodString = false;

	goodString = re.test(stringToTest);
	if(goodString){
		if(document.getElementById(element+'_valid_image')){
			document.getElementById(element+'_valid_image').src = 'http://www.visitithaca.com/admin/themes/Default/images/form_valid.gif';
		}
		return true;
	}
	else{
		if(document.getElementById(element+'_valid_image')){
			document.getElementById(element+'_valid_image').src = 'http://www.visitithaca.com/admin/themes/Default/images/form_not_valid.gif';
		}
		return false;
	}
}

function validateDescription(stringType){
if(stringType=='blnk'){return '';}
if(stringType=='date'){return 'A date must be in the format mm/dd/yyyy.  For example 03/19/1982,';}
if(stringType=='emal'){return 'An email address must contain the @ symbol and a valid domain name; like joe@example.com.';}
if(stringType=='flot'){return 'A floating point number can be a whole number or a decimal like "6" or "3.141592653".';}
if(stringType=='gtxt'){return 'General text that can contain most special characters with a few exceptions.  Like "This is my \'Description\'!?".';}
if(stringType=='htxt'){return 'HTML text that can contain most special characters and html tags with a few exceptions.  Like "<b>My Title</b>Here are the options<ul><li>a</li></ul>".';}
if(stringType=='keyp'){return 'Provide a unique phrase or word that best describes the content found on this page. If you wish to use more keyphrases, simply seperate them with a comma.';}
if(stringType=='link'){return 'A Link to a website.  A link must contain the full protocol.  Like "http://www.example.com".';}
if(stringType=='ltxt'){return 'This is the "clickable" link text in a menu or other website navigation object.  In the case of an image link, this text will appear as the image description. Like "My Page Title". Several special characters like &gt; and &lt; are NOT allowed.';}
if(stringType=='mdes'){return 'Provide a concise description of the content found on this page, no more than 155 characters.  Include if appropriote, a couple of the most relevant key phrases within your sentence based statement.';}
if(stringType=='name'){return 'A person\'s name can contain any combination of letters, spaces, dashes, and can be up to 64 characters long. Like Anne, or Smith.';}
if(stringType=='numb'){return 'A whole number containing no decimals, commas, or spaces.  Like 23, -158, or 79932.';}
if(stringType=='pass'){return 'A password must be between 6 and 32 characters long and have at least 1 number, at least one uppercase letter and at least one lowercase letter.';}
if(stringType=='phon'){return 'A phone number must be no more than 50 characters long.';}
if(stringType=='ptle'){return 'This is the title that will show up in search engine results, and when users bookmark your page.  You should pick something short and descriptive like "Our Home Page".  It is also the basis for the filename of your page, e.g. "Our Home Page" turns into "Our-Home-Page.html".';}
if(stringType=='seas'){return 'Valid seasons are winter, spring, summer, and fall. Note: Seasons must be entered all lowercase.';}
if(stringType=='spas'){return 'A password must be between 6 and 32 characters long and should consist of as many letters, numbers, and special characters as possible.';}
if(stringType=='stxt'){return 'Text that contains special characters. Like "This is my \'Description\'!?".';}
if(stringType=='user'){return 'A username must be between 4 and 32 characters long and can consist of numbers and letters; like Matt';}
if(stringType=='zipc'){return 'A zip code most be in the format 12345, 12345-54321, A1B2C3, or A1B 2C3.';}
	return ''; // no matches
}

function validateForm(formName){
      
      var obj = document.forms[formName]
      deleting = false;
      delre = /delete/;  //regular expression for delete check box
      
      for (i=0; obj.elements[i]; i++) {
            
			obj.elements[i].value = obj.elements[i].value.replace(/^\s+|\s+$/g, '') ;
            currentElement = obj.elements[i].name;
            currentValue = obj.elements[i].value;
            isValid = true;
            
            if(delre.test(currentElement)){
                  if(obj.elements[i].checked==true) deleting = true;
            }
            
            if(currentElement.substr(4,2)=='t-' || currentElement.substr(4,2)=='f-'){
                  stringType = currentElement.substr(0,4);
                  canBeEmpty = currentElement.substr(4,1);
				  
                  if(canBeEmpty=='t'){
                        canBeEmpty = true;
						canBeEmptyDescription = 'You can leave this field empty.';
                  }
                  else if(canBeEmpty=='f'){
                        canBeEmpty = false;
						canBeEmptyDescription = 'You can NOT leave this field empty.';
                  }
                  if(canBeEmpty && document.getElementById(currentElement).value=='') isValid = true;
                  else isValid = validateString(currentElement);
            }
            
            if(!isValid){
				obj.elements[i].className='formElementError';
				obj.elements[i].focus();
				alert(validateDescription(stringType) + '\n' + canBeEmptyDescription + '\nYou will need to fix this before continuing. ');
				return false;
				break;
            }
            else{
                  obj.elements[i].className='';
            }
      }
      
      if(deleting==true){
            return confirm('You have objects selected for deletion.\n This cannot be undone!\n Are you sure you wish to continue?');
      }
      return true;
}

function formatPhoneNumber(elementID){
	if(document.getElementById(elementID)){
		number_final = '';
		number = document.getElementById(elementID).value;
		for(i=0; i<number.length; i++){
			temp_number = number.substr(i, 1);
			if(isNumber(temp_number)){
				number_final = number_final + temp_number;
			}
		}
		if(number_final.length>7){
			document.getElementById(elementID).value = '(' + number_final.substr(0, 3) + ') ' + number_final.substr(3, 3) + '-' + number_final.substr(6, 4);
		}
	}
}

function roundFloat(floatNum,dec){
	floatNum = parseFloat(floatNum);
    return floatNum.toFixed(dec);
}

function isNumber(number){
    re = /^[0-9\.]+$/;
    return re.test(number);
}

function windowWidth(){
	var myWidth = 0;
	if(typeof(window.innerWidth)=='number'){
		//Non-IE
		myWidth = window.innerWidth;
	}
	else if(document.documentElement && document.documentElement.clientWidth){
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	}
	else if(document.body && document.body.clientWidth){
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}

function windowHeight(){
	var myHeight = 0;
	if(typeof(window.innerHeight)=='number'){
		//Non-IE
		myHeight = window.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight){
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	}
	else if(document.body && document.body.clientHeight){
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

function setElementSize(elementID, newWidth, newHeight, maximizeWidth, maximizeHeight) {
	if(maximizeWidth){
		newWidth = windowWidth()-25;
	}
	if(maximizeHeight){
		newHeight = windowHeight()-100;
	}
	if(newWidth){
		document.getElementById(elementID).width = newWidth;
	}
	if(newHeight){
		document.getElementById(elementID).height = newHeight;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s*/, "").replace(/\s*$/, "");
}

/************************************************************************************************************
JS Calendar
Copyright (C) September 2006  DTHMLGoodies.com, Alf Magne Kalleland

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.

Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com

************************************************************************************************************/

/* Update log:
(C) www.dhtmlgoodies.com, September 2005

Version 1.2, November 8th - 2005 - Added <iframe> background in IE
Version 1.3, November 12th - 2005 - Fixed top bar position in Opera 7
Version 1.4, December 28th - 2005 - Support for Spanish and Portuguese
Version 1.5, January  18th - 2006 - Fixed problem with next-previous buttons after a month has been selected from dropdown
Version 1.6, February 22nd - 2006 - Added variable which holds the path to images.
									Format todays date at the bottom by use of the todayStringFormat variable
									Pick todays date by clicking on todays date at the bottom of the calendar
Version 2.0	 May, 25th - 2006	  - Added support for time(hour and minutes) and changing year and hour when holding mouse over + and - options. (i.e. instead of click)
Version 2.1	 July, 2nd - 2006	  - Added support for more date formats(example: d.m.yyyy, i.e. one letter day and month).

// Modifications by Gregg Buntin
Version 2.1.1 8/9/2007  gfb   - Add switch to turn off Year Span Selection
                                This allows me to only have this year & next year in the drop down
                                     
Version 2.1.2 8/30/2007 gfb  - Add switch to start week on Sunday
                               Add switch to turn off week number display
                               Fix bug when using on an HTTPS page

*/
var turnOffYearSpan = true;     // true = Only show This Year and Next, false = show +/- 5 years
var weekStartsOnSunday = true;  // true = Start the week on Sunday, false = start the week on Monday
var showWeekNumber = false;  // true = show week number,  false = do not show week number

var languageCode = 'en';	// Possible values: 	en,ge,no,nl,es,pt-br,fr
							// en = english, ge = german, no = norwegian,nl = dutch, es = spanish, pt-br = portuguese, fr = french, da = danish, hu = hungarian(Use UTF-8 doctype for hungarian)

var calendar_display_time = true;

// Format of current day at the bottom of the calendar
// [todayString] = the value of todayString
// [dayString] = day of week (examle: mon, tue, wed...)
// [UCFdayString] = day of week (examle: Mon, Tue, Wed...) ( First letter in uppercase)
// [day] = Day of month, 1..31
// [monthString] = Name of current month
// [year] = Current year
var todayStringFormat = '[todayString] [UCFdayString]. [day]. [monthString] [year]';
var pathToImages = 'http://www.visitithaca.com/admin/js_calendar/i/';	// Relative to your HTML file

var speedOfSelectBoxSliding = 200;	// Milliseconds between changing year and hour when holding mouse over "-" and "+" - lower value = faster
var intervalSelectBox_minutes = 5;	// Minute select box - interval between each option (5 = default)

var calendar_offsetTop = 0;		// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendar_offsetLeft = 0;	// Offset - calendar placement - You probably have to modify this value if you're not using a strict doctype
var calendarDiv = false;

var MSIE = false;
var Opera = false;
if(navigator.userAgent.indexOf('MSIE')>=0 && navigator.userAgent.indexOf('Opera')<0)MSIE=true;
if(navigator.userAgent.indexOf('Opera')>=0)Opera=true;


switch(languageCode){
	case "en":	/* English */
		var monthArray = ['January','February','March','April','May','June','July','August','September','October','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
		var dayArray = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];
		var weekString = 'Week';
		var todayString = '';
		break;
	case "ge":	/* German */
		var monthArray = ['Januar','Februar','M�rz','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Dez'];
		var dayArray = ['Mon','Die','Mit','Don','Fre','Sam','Son'];
		var weekString = 'Woche';
		var todayString = 'Heute';
		break;
	case "no":	/* Norwegian */
		var monthArray = ['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mai','Jun','Jul','Aug','Sep','Okt','Nov','Des'];
		var dayArray = ['Man','Tir','Ons','Tor','Fre','L&oslash;r','S&oslash;n'];
		var weekString = 'Uke';
		var todayString = 'Dagen i dag er';
		break;
	case "nl":	/* Dutch */
		var monthArray = ['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
		var dayArray = ['Ma','Di','Wo','Do','Vr','Za','Zo'];
		var weekString = 'Week';
		var todayString = 'Vandaag';
		break;
	case "es": /* Spanish */
		var monthArray = ['Enero','Febrero','Marzo','April','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
		var monthArrayShort =['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'];
		var dayArray = ['Lun','Mar','Mie','Jue','Vie','Sab','Dom'];
		var weekString = 'Semana';
		var todayString = 'Hoy es';
		break;
	case "pt-br":  /* Brazilian portuguese (pt-br) */
		var monthArray = ['Janeiro','Fevereiro','Mar&ccedil;o','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'];
		var monthArrayShort = ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'];
		var dayArray = ['Seg','Ter','Qua','Qui','Sex','S&aacute;b','Dom'];
		var weekString = 'Sem.';
		var todayString = 'Hoje &eacute;';
		break;
	case "fr":      /* French */
		var monthArray = ['Janvier','F�vrier','Mars','Avril','Mai','Juin','Juillet','Ao�t','Septembre','Octobre','Novembre','D�cembre'];
		var monthArrayShort = ['Jan','Fev','Mar','Avr','Mai','Jun','Jul','Aou','Sep','Oct','Nov','Dec'];
		var dayArray = ['Lun','Mar','Mer','Jeu','Ven','Sam','Dim'];
		var weekString = 'Sem';
		var todayString = "Aujourd'hui";
		break;
	case "da": /*Danish*/
		var monthArray = ['januar','februar','marts','april','maj','juni','juli','august','september','oktober','november','december'];
		var monthArrayShort = ['jan','feb','mar','apr','maj','jun','jul','aug','sep','okt','nov','dec'];
		var dayArray = ['man','tirs','ons','tors','fre','l&oslash;r','s&oslash;n'];
		var weekString = 'Uge';
		var todayString = 'I dag er den';
		break;
	case "hu":	/* Hungarian  - Remember to use UTF-8 encoding, i.e. the <meta> tag */
		var monthArray = ['Január','Február','Március','�?prilis','Május','Június','Július','Augusztus','Szeptember','Október','November','December'];
		var monthArrayShort = ['Jan','Feb','Márc','�?pr','Máj','Jún','Júl','Aug','Szep','Okt','Nov','Dec'];
		var dayArray = ['Hé','Ke','Sze','Cs','Pé','Szo','Vas'];
		var weekString = 'Hét';
		var todayString = 'Mai nap';
		break;
	case "it":	/* Italian*/
		var monthArray = ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'];
		var monthArrayShort = ['Gen','Feb','Mar','Apr','Mag','Giu','Lugl','Ago','Set','Ott','Nov','Dic'];
		var dayArray = ['Lun',';Mar','Mer','Gio','Ven','Sab','Dom'];
		var weekString = 'Settimana';
		var todayString = 'Oggi &egrave; il';
		break;
	case "sv":	/* Swedish */
		var monthArray = ['Januari','Februari','Mars','April','Maj','Juni','Juli','Augusti','September','Oktober','November','December'];
		var monthArrayShort = ['Jan','Feb','Mar','Apr','Maj','Jun','Jul','Aug','Sep','Okt','Nov','Dec'];
		var dayArray = ['M&aring;n','Tis','Ons','Tor','Fre','L&ouml;r','S&ouml;n'];
		var weekString = 'Vecka';
		var todayString = 'Idag &auml;r det den';
		break;
	case "cz":	/* Czech */
		var monthArray = ['leden','&#250;nor','b&#345;ezen','duben','kv&#283;ten','&#269;erven','&#269;ervenec','srpen','z&#225;&#345;&#237;','&#345;&#237;jen','listopad','prosinec'];
		var monthArrayShort = ['led','&#250;n','b&#345;','dub','kv&#283;','&#269;er','&#269;er-ec','srp','z&#225;&#345;','&#345;&#237;j','list','pros'];
		var dayArray = ['Pon','&#218;t','St','&#268;t','P&#225;','So','Ne'];
		var weekString = 't&#253;den';
		var todayString = '';
		break;	
}

if (weekStartsOnSunday) {
   var tempDayName = dayArray[6];
   for(var theIx = 6; theIx > 0; theIx--) {
      dayArray[theIx] = dayArray[theIx-1];
   }
   dayArray[0] = tempDayName;
}



var daysInMonthArray = [31,28,31,30,31,30,31,31,30,31,30,31];
var currentMonth;
var currentYear;
var currentHour;
var currentMinute;
var calendarContentDiv;
var returnDateTo;
var returnFormat;
var activeSelectBoxMonth;
var activeSelectBoxYear;
var activeSelectBoxHour;
var activeSelectBoxMinute;

var iframeObj = false;
//// fix for EI frame problem on time dropdowns 09/30/2006
var iframeObj2 =false;
function EIS_FIX_EI1(where2fixit)
{

		if(!iframeObj2)return;
		iframeObj2.style.display = 'block';
		iframeObj2.style.height =document.getElementById(where2fixit).offsetHeight+1;
		iframeObj2.style.width=document.getElementById(where2fixit).offsetWidth;
		iframeObj2.style.left=getleftPos(document.getElementById(where2fixit))+1-calendar_offsetLeft;
		iframeObj2.style.top=getTopPos(document.getElementById(where2fixit))-document.getElementById(where2fixit).offsetHeight-calendar_offsetTop;
}

function EIS_Hide_Frame()
{		if(iframeObj2)iframeObj2.style.display = 'none';}
//// fix for EI frame problem on time dropdowns 09/30/2006
var returnDateToYear;
var returnDateToMonth;
var returnDateToDay;
var returnDateToHour;
var returnDateToMinute;

var inputYear;
var inputMonth;
var inputDay;
var inputHour;
var inputMinute;
var calendarDisplayTime = false;

var selectBoxHighlightColor = '#D60808'; // Highlight color of select boxes
var selectBoxRolloverBgColor = '#E2EBED'; // Background color on drop down lists(rollover)

var selectBoxMovementInProgress = false;
var activeSelectBox = false;

function cancelCalendarEvent()
{
	return false;
}
function isLeapYear(inputYear)
{
	if(inputYear%400==0||(inputYear%4==0&&inputYear%100!=0)) return true;
	return false;

}
var activeSelectBoxMonth = false;
var activeSelectBoxDirection = false;

function highlightMonthYear()
{
	if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
	activeSelectBox = this;


	if(this.className=='monthYearActive'){
		this.className='';
	}else{
		this.className = 'monthYearActive';
		activeSelectBoxMonth = this;
	}

	if(this.innerHTML.indexOf('-')>=0 || this.innerHTML.indexOf('+')>=0){
		if(this.className=='monthYearActive')
			selectBoxMovementInProgress = true;
		else
			selectBoxMovementInProgress = false;
		if(this.innerHTML.indexOf('-')>=0)activeSelectBoxDirection = -1; else activeSelectBoxDirection = 1;

	}else selectBoxMovementInProgress = false;

}

function showMonthDropDown()
{
	if(document.getElementById('monthDropDown').style.display=='block'){
		document.getElementById('monthDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('monthDropDown').style.display='block';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
			if (MSIE)
		{ EIS_FIX_EI1('monthDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006

	}
}

function showYearDropDown()
{
	if(document.getElementById('yearDropDown').style.display=='block'){
		document.getElementById('yearDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('yearDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
			if (MSIE)
		{ EIS_FIX_EI1('yearDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006

	}

}
function showHourDropDown()
{
	if(document.getElementById('hourDropDown').style.display=='block'){
		document.getElementById('hourDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('hourDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('minuteDropDown').style.display='none';
				if (MSIE)
		{ EIS_FIX_EI1('hourDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006
	}

}
function showMinuteDropDown()
{
	if(document.getElementById('minuteDropDown').style.display=='block'){
		document.getElementById('minuteDropDown').style.display='none';
		//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	}else{
		document.getElementById('minuteDropDown').style.display='block';
		document.getElementById('monthDropDown').style.display='none';
		document.getElementById('yearDropDown').style.display='none';
		document.getElementById('hourDropDown').style.display='none';
				if (MSIE)
		{ EIS_FIX_EI1('minuteDropDown')}
		//// fix for EI frame problem on time dropdowns 09/30/2006
	}

}

function selectMonth()
{
	document.getElementById('calendar_month_txt').innerHTML = this.innerHTML
	currentMonth = this.id.replace(/[^\d]/g,'');

	document.getElementById('monthDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	for(var no=0;no<monthArray.length;no++){
		document.getElementById('monthDiv_'+no).style.color='';
	}
	this.style.color = selectBoxHighlightColor;
	activeSelectBoxMonth = this;
	writeCalendarContent();

}

function selectHour()
{
	document.getElementById('calendar_hour_txt').innerHTML = this.innerHTML
	currentHour = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('hourDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxHour){
		activeSelectBoxHour.style.color='';
	}
	activeSelectBoxHour=this;
	this.style.color = selectBoxHighlightColor;
}

function selectMinute()
{
	document.getElementById('calendar_minute_txt').innerHTML = this.innerHTML
	currentMinute = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('minuteDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxMinute){
		activeSelectBoxMinute.style.color='';
	}
	activeSelectBoxMinute=this;
	this.style.color = selectBoxHighlightColor;
}


function selectYear()
{
	document.getElementById('calendar_year_txt').innerHTML = this.innerHTML
	currentYear = this.innerHTML.replace(/[^\d]/g,'');
	document.getElementById('yearDropDown').style.display='none';
	//// fix for EI frame problem on time dropdowns 09/30/2006
				EIS_Hide_Frame();
	if(activeSelectBoxYear){
		activeSelectBoxYear.style.color='';
	}
	activeSelectBoxYear=this;
	this.style.color = selectBoxHighlightColor;
	writeCalendarContent();

}

function switchMonth()
{
	if(this.src.indexOf('left')>=0){
		currentMonth=currentMonth-1;;
		if(currentMonth<0){
			currentMonth=11;
			currentYear=currentYear-1;
		}
	}else{
		currentMonth=currentMonth+1;;
		if(currentMonth>11){
			currentMonth=0;
			currentYear=currentYear/1+1;
		}
	}

	writeCalendarContent();


}

function createMonthDiv(){
	var div = document.createElement('DIV');
	div.className='monthYearPicker';
	div.id = 'monthPicker';

	for(var no=0;no<monthArray.length;no++){
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = monthArray[no];
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectMonth;
		subDiv.id = 'monthDiv_' + no;
		subDiv.style.width = '56px';
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentMonth && currentMonth==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxMonth = subDiv;
		}

	}
	return div;

}

function changeSelectBoxYear(e,inputObj)
{
	if(!inputObj)inputObj =this;
	var yearItems = inputObj.parentNode.getElementsByTagName('DIV');
	if(inputObj.innerHTML.indexOf('-')>=0){
		var startYear = yearItems[1].innerHTML/1 -1;
		if(activeSelectBoxYear){
			activeSelectBoxYear.style.color='';
		}
	}else{
		var startYear = yearItems[1].innerHTML/1 +1;
		if(activeSelectBoxYear){
			activeSelectBoxYear.style.color='';

		}
	}

	for(var no=1;no<yearItems.length-1;no++){
		yearItems[no].innerHTML = startYear+no-1;
		yearItems[no].id = 'yearDiv' + (startYear/1+no/1-1);

	}
	if(activeSelectBoxYear){
		activeSelectBoxYear.style.color='';
		if(document.getElementById('yearDiv'+currentYear)){
			activeSelectBoxYear = document.getElementById('yearDiv'+currentYear);
			activeSelectBoxYear.style.color=selectBoxHighlightColor;;
		}
	}
}
function changeSelectBoxHour(e,inputObj)
{
	if(!inputObj)inputObj = this;

	var hourItems = inputObj.parentNode.getElementsByTagName('DIV');
	if(inputObj.innerHTML.indexOf('-')>=0){
		var startHour = hourItems[1].innerHTML/1 -1;
		if(startHour<0)startHour=0;
		if(activeSelectBoxHour){
			activeSelectBoxHour.style.color='';
		}
	}else{
		var startHour = hourItems[1].innerHTML/1 +1;
		if(startHour>14)startHour = 14;
		if(activeSelectBoxHour){
			activeSelectBoxHour.style.color='';

		}
	}
	var prefix = '';
	for(var no=1;no<hourItems.length-1;no++){
		if((startHour/1 + no/1) < 11)prefix = '0'; else prefix = '';
		hourItems[no].innerHTML = prefix + (startHour+no-1);

		hourItems[no].id = 'hourDiv' + (startHour/1+no/1-1);

	}
	if(activeSelectBoxHour){
		activeSelectBoxHour.style.color='';
		if(document.getElementById('hourDiv'+currentHour)){
			activeSelectBoxHour = document.getElementById('hourDiv'+currentHour);
			activeSelectBoxHour.style.color=selectBoxHighlightColor;;
		}
	}
}

function updateYearDiv()
{
    var yearSpan = 5;
    if (turnOffYearSpan) {
       yearSpan = 0;
    }
	var div = document.getElementById('yearDropDown');
	var yearItems = div.getElementsByTagName('DIV');
	for(var no=1;no<yearItems.length-1;no++){
		yearItems[no].innerHTML = currentYear/1 -yearSpan + no;
		if(currentYear==(currentYear/1 -yearSpan + no)){
			yearItems[no].style.color = selectBoxHighlightColor;
			activeSelectBoxYear = yearItems[no];
		}else{
			yearItems[no].style.color = '';
		}
	}
}

function updateMonthDiv()
{
	for(no=0;no<12;no++){
		document.getElementById('monthDiv_' + no).style.color = '';
	}
	document.getElementById('monthDiv_' + currentMonth).style.color = selectBoxHighlightColor;
	activeSelectBoxMonth = 	document.getElementById('monthDiv_' + currentMonth);
}


function updateHourDiv()
{
	var div = document.getElementById('hourDropDown');
	var hourItems = div.getElementsByTagName('DIV');

	var addHours = 0;
	if((currentHour/1 -6 + 1)<0){
		addHours = 	(currentHour/1 -6 + 1)*-1;
	}
	for(var no=1;no<hourItems.length-1;no++){
		var prefix='';
		if((currentHour/1 -6 + no + addHours) < 10)prefix='0';
		hourItems[no].innerHTML = prefix +  (currentHour/1 -6 + no + addHours);
		if(currentHour==(currentHour/1 -6 + no)){
			hourItems[no].style.color = selectBoxHighlightColor;
			activeSelectBoxHour = hourItems[no];
		}else{
			hourItems[no].style.color = '';
		}
	}
}

function updateMinuteDiv()
{
	for(no=0;no<60;no+=intervalSelectBox_minutes){
		var prefix = '';
		if(no<10)prefix = '0';

		document.getElementById('minuteDiv_' + prefix + no).style.color = '';
	}
	if(document.getElementById('minuteDiv_' + currentMinute)){
		document.getElementById('minuteDiv_' + currentMinute).style.color = selectBoxHighlightColor;
		activeSelectBoxMinute = document.getElementById('minuteDiv_' + currentMinute);
	}
}



function createYearDiv()
{

	if(!document.getElementById('yearDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('yearDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}


	var d = new Date();
	if(currentYear){
		d.setFullYear(currentYear);
	}

	var startYear = d.getFullYear()/1 - 5;

    var yearSpan = 10;
	if (! turnOffYearSpan) {
    	var subDiv = document.createElement('DIV');
    	subDiv.innerHTML = '&nbsp;&nbsp;- ';
    	subDiv.onclick = changeSelectBoxYear;
    	subDiv.onmouseover = highlightMonthYear;
    	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
    	subDiv.onselectstart = cancelCalendarEvent;
    	div.appendChild(subDiv);
    } else {
       startYear = d.getFullYear()/1 - 0;
       yearSpan = 2;
    }

	for(var no=startYear;no<(startYear+yearSpan);no++){
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectYear;
		subDiv.id = 'yearDiv' + no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	if (! turnOffYearSpan) {
    	var subDiv = document.createElement('DIV');
    	subDiv.innerHTML = '&nbsp;&nbsp;+ ';
    	subDiv.onclick = changeSelectBoxYear;
    	subDiv.onmouseover = highlightMonthYear;
    	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
    	subDiv.onselectstart = cancelCalendarEvent;
    	div.appendChild(subDiv);
	}
	return div;
}

/* This function creates the hour div at the bottom bar */

function slideCalendarSelectBox()
{
	if(selectBoxMovementInProgress){
		if(activeSelectBox.parentNode.id=='hourDropDown'){
			changeSelectBoxHour(false,activeSelectBox);
		}
		if(activeSelectBox.parentNode.id=='yearDropDown'){
			changeSelectBoxYear(false,activeSelectBox);
		}

	}
	setTimeout('slideCalendarSelectBox()',speedOfSelectBoxSliding);

}

function createHourDiv()
{
	if(!document.getElementById('hourDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('hourDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}

	if(!currentHour)currentHour=0;
	var startHour = currentHour/1;
	if(startHour>14)startHour=14;

	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = '&nbsp;&nbsp;- ';
	subDiv.onclick = changeSelectBoxHour;
	subDiv.onmouseover = highlightMonthYear;
	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
	subDiv.onselectstart = cancelCalendarEvent;
	div.appendChild(subDiv);

	for(var no=startHour;no<startHour+10;no++){
		var prefix = '';
		if(no/1<10)prefix='0';
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = prefix + no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectHour;
		subDiv.id = 'hourDiv' + no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = '&nbsp;&nbsp;+ ';
	subDiv.onclick = changeSelectBoxHour;
	subDiv.onmouseover = highlightMonthYear;
	subDiv.onmouseout = function(){ selectBoxMovementInProgress = false;};
	subDiv.onselectstart = cancelCalendarEvent;
	div.appendChild(subDiv);

	return div;
}
/* This function creates the minute div at the bottom bar */

function createMinuteDiv()
{
	if(!document.getElementById('minuteDropDown')){
		var div = document.createElement('DIV');
		div.className='monthYearPicker';
	}else{
		var div = document.getElementById('minuteDropDown');
		var subDivs = div.getElementsByTagName('DIV');
		for(var no=0;no<subDivs.length;no++){
			subDivs[no].parentNode.removeChild(subDivs[no]);
		}
	}
	var startMinute = 0;
	var prefix = '';
	for(var no=startMinute;no<60;no+=intervalSelectBox_minutes){

		if(no<10)prefix='0'; else prefix = '';
		var subDiv = document.createElement('DIV');
		subDiv.innerHTML = prefix + no;
		subDiv.onmouseover = highlightMonthYear;
		subDiv.onmouseout = highlightMonthYear;
		subDiv.onclick = selectMinute;
		subDiv.id = 'minuteDiv_' + prefix +  no;
		subDiv.onselectstart = cancelCalendarEvent;
		div.appendChild(subDiv);
		if(currentYear && currentYear==no){
			subDiv.style.color = selectBoxHighlightColor;
			activeSelectBoxYear = subDiv;
		}
	}
	return div;
}

function highlightSelect()
{

	if(this.className=='selectBoxTime'){
		this.className = 'selectBoxTimeOver';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time_over.gif';
	}else if(this.className=='selectBoxTimeOver'){
		this.className = 'selectBoxTime';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_time.gif';
	}

	if(this.className=='selectBox'){
		this.className = 'selectBoxOver';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down_over.gif';
	}else if(this.className=='selectBoxOver'){
		this.className = 'selectBox';
		this.getElementsByTagName('IMG')[0].src = pathToImages + 'down.gif';
	}

}

function highlightArrow()
{
	if(this.src.indexOf('over')>=0){
		if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left.gif';
		if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right.gif';
	}else{
		if(this.src.indexOf('left')>=0)this.src = pathToImages + 'left_over.gif';
		if(this.src.indexOf('right')>=0)this.src = pathToImages + 'right_over.gif';
	}
}

function highlightClose()
{
	if(this.src.indexOf('over')>=0){
		this.src = pathToImages + 'close.gif';
	}else{
		this.src = pathToImages + 'close_over.gif';
	}

}

function closeCalendar(){

	document.getElementById('yearDropDown').style.display='none';
	document.getElementById('monthDropDown').style.display='none';
	document.getElementById('hourDropDown').style.display='none';
	document.getElementById('minuteDropDown').style.display='none';

	calendarDiv.style.display='none';
	if(iframeObj){
		iframeObj.style.display='none';
		 //// //// fix for EI frame problem on time dropdowns 09/30/2006
			EIS_Hide_Frame();}
	if(activeSelectBoxMonth)activeSelectBoxMonth.className='';
	if(activeSelectBoxYear)activeSelectBoxYear.className='';


}

function writeTopBar()
{

	var topBar = document.createElement('DIV');
	topBar.className = 'topBar';
	topBar.id = 'topBar';
	calendarDiv.appendChild(topBar);

	// Left arrow
	var leftDiv = document.createElement('DIV');
	leftDiv.style.marginRight = '1px';
	var img = document.createElement('IMG');
	img.src = pathToImages + 'left.gif';
	img.onmouseover = highlightArrow;
	img.onclick = switchMonth;
	img.onmouseout = highlightArrow;
	leftDiv.appendChild(img);
	topBar.appendChild(leftDiv);
	if(Opera)leftDiv.style.width = '16px';

	// Right arrow
	var rightDiv = document.createElement('DIV');
	rightDiv.style.marginRight = '1px';
	var img = document.createElement('IMG');
	img.src = pathToImages + 'right.gif';
	img.onclick = switchMonth;
	img.onmouseover = highlightArrow;
	img.onmouseout = highlightArrow;
	rightDiv.appendChild(img);
	if(Opera)rightDiv.style.width = '16px';
	topBar.appendChild(rightDiv);


	// Month selector
	var monthDiv = document.createElement('DIV');
	monthDiv.id = 'monthSelect';
	monthDiv.onmouseover = highlightSelect;
	monthDiv.onmouseout = highlightSelect;
	monthDiv.onclick = showMonthDropDown;
	var span = document.createElement('SPAN');
	span.innerHTML = monthArray[currentMonth];
	span.id = 'calendar_month_txt';
	monthDiv.appendChild(span);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down.gif';
	img.style.position = 'absolute';
	img.style.right = '0px';
	monthDiv.appendChild(img);
	monthDiv.className = 'selectBox';
	if(Opera){
		img.style.cssText = 'float:right;position:relative';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}
	topBar.appendChild(monthDiv);

	var monthPicker = createMonthDiv();
	monthPicker.style.left = '37px';
	monthPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	monthPicker.style.width ='60px';
	monthPicker.id = 'monthDropDown';

	calendarDiv.appendChild(monthPicker);

	// Year selector
	var yearDiv = document.createElement('DIV');
	yearDiv.onmouseover = highlightSelect;
	yearDiv.onmouseout = highlightSelect;
	yearDiv.onclick = showYearDropDown;
	var span = document.createElement('SPAN');
	span.innerHTML = currentYear;
	span.id = 'calendar_year_txt';
	yearDiv.appendChild(span);
	topBar.appendChild(yearDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down.gif';
	yearDiv.appendChild(img);
	yearDiv.className = 'selectBox';

	if(Opera){
		yearDiv.style.width = '50px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var yearPicker = createYearDiv();
	yearPicker.style.left = '113px';
	yearPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	yearPicker.style.width = '35px';
	yearPicker.id = 'yearDropDown';
	calendarDiv.appendChild(yearPicker);


	var img = document.createElement('IMG');
	img.src = pathToImages + 'close.gif';
	img.style.styleFloat = 'right';
	img.onmouseover = highlightClose;
	img.onmouseout = highlightClose;
	img.onclick = closeCalendar;
	topBar.appendChild(img);
	if(!document.all){
		img.style.position = 'absolute';
		img.style.right = '2px';
	}



}

function writeCalendarContent()
{
	var calendarContentDivExists = true;
	if(!calendarContentDiv){
		calendarContentDiv = document.createElement('DIV');
		calendarDiv.appendChild(calendarContentDiv);
		calendarContentDivExists = false;
	}
	currentMonth = currentMonth/1;
	var d = new Date();

	d.setFullYear(currentYear);
	d.setDate(1);
	d.setMonth(currentMonth);

	var dayStartOfMonth = d.getDay();
	if (! weekStartsOnSunday) {
      if(dayStartOfMonth==0)dayStartOfMonth=7;
      dayStartOfMonth--;
   }

	document.getElementById('calendar_year_txt').innerHTML = currentYear;
	document.getElementById('calendar_month_txt').innerHTML = monthArray[currentMonth];
	document.getElementById('calendar_hour_txt').innerHTML = currentHour;
	document.getElementById('calendar_minute_txt').innerHTML = currentMinute;

	var existingTable = calendarContentDiv.getElementsByTagName('TABLE');
	if(existingTable.length>0){
		calendarContentDiv.removeChild(existingTable[0]);
	}

	var calTable = document.createElement('TABLE');
	calTable.width = '100%';
	calTable.cellSpacing = '0';
	calendarContentDiv.appendChild(calTable);




	var calTBody = document.createElement('TBODY');
	calTable.appendChild(calTBody);
	var row = calTBody.insertRow(-1);
	row.className = 'calendar_week_row';
   if (showWeekNumber) {
      var cell = row.insertCell(-1);
	   cell.innerHTML = weekString;
	   cell.className = 'calendar_week_column';
	   cell.style.backgroundColor = selectBoxRolloverBgColor;
	}

	for(var no=0;no<dayArray.length;no++){
		var cell = row.insertCell(-1);
		cell.innerHTML = dayArray[no];
	}

	var row = calTBody.insertRow(-1);

   if (showWeekNumber) {
	   var cell = row.insertCell(-1);
	   cell.className = 'calendar_week_column';
	   cell.style.backgroundColor = selectBoxRolloverBgColor;
	   var week = getWeek(currentYear,currentMonth,1);
	   cell.innerHTML = week;		// Week
	}
	for(var no=0;no<dayStartOfMonth;no++){
		var cell = row.insertCell(-1);
		cell.innerHTML = '&nbsp;';
	}

	var colCounter = dayStartOfMonth;
	var daysInMonth = daysInMonthArray[currentMonth];
	if(daysInMonth==28){
		if(isLeapYear(currentYear))daysInMonth=29;
	}

	for(var no=1;no<=daysInMonth;no++){
		d.setDate(no-1);
		if(colCounter>0 && colCounter%7==0){
			var row = calTBody.insertRow(-1);
         if (showWeekNumber) {
            var cell = row.insertCell(-1);
            cell.className = 'calendar_week_column';
            var week = getWeek(currentYear,currentMonth,no);
            cell.innerHTML = week;		// Week
            cell.style.backgroundColor = selectBoxRolloverBgColor;
         }
		}
		var cell = row.insertCell(-1);
		if(currentYear==inputYear && currentMonth == inputMonth && no==inputDay){
			cell.className='activeDay';
		}
		cell.innerHTML = no;
		cell.onclick = pickDate;
		colCounter++;
	}


	if(!document.all){
		if(calendarContentDiv.offsetHeight)
			document.getElementById('topBar').style.top = calendarContentDiv.offsetHeight + document.getElementById('timeBar').offsetHeight + document.getElementById('topBar').offsetHeight -1 + 'px';
		else{
			document.getElementById('topBar').style.top = '';
			document.getElementById('topBar').style.bottom = '0px';
		}

	}

	if(iframeObj){
		if(!calendarContentDivExists)setTimeout('resizeIframe()',350);else setTimeout('resizeIframe()',10);
	}




}

function resizeIframe()
{
	iframeObj.style.width = calendarDiv.offsetWidth + 'px';
	iframeObj.style.height = calendarDiv.offsetHeight + 'px' ;


}

function pickTodaysDate()
{
	var d = new Date();
	currentMonth = d.getMonth();
	currentYear = d.getFullYear();
	pickDate(false,d.getDate());

}

function pickDate(e,inputDay)
{
	var month = currentMonth/1 +1;
	if(month<10)month = '0' + month;
	var day;
	if(!inputDay && this)day = this.innerHTML; else day = inputDay;

	if(day/1<10)day = '0' + day;
	if(returnFormat){
		returnFormat = returnFormat.replace('dd',day);
		returnFormat = returnFormat.replace('mm',month);
		returnFormat = returnFormat.replace('yyyy',currentYear);
		returnFormat = returnFormat.replace('hh',currentHour);
		returnFormat = returnFormat.replace('ii',currentMinute);
		returnFormat = returnFormat.replace('d',day/1);
		returnFormat = returnFormat.replace('m',month/1);

		returnDateTo.value = returnFormat;
		try{
			returnDateTo.onchange();
		}catch(e){

		}
	}else{
		for(var no=0;no<returnDateToYear.options.length;no++){
			if(returnDateToYear.options[no].value==currentYear){
				returnDateToYear.selectedIndex=no;
				break;
			}
		}
		for(var no=0;no<returnDateToMonth.options.length;no++){
			if(returnDateToMonth.options[no].value==parseInt(month)){
				returnDateToMonth.selectedIndex=no;
				break;
			}
		}
		for(var no=0;no<returnDateToDay.options.length;no++){
			if(returnDateToDay.options[no].value==parseInt(day)){
				returnDateToDay.selectedIndex=no;
				break;
			}
		}
		if(calendarDisplayTime){
			for(var no=0;no<returnDateToHour.options.length;no++){
				if(returnDateToHour.options[no].value==parseInt(currentHour)){
					returnDateToHour.selectedIndex=no;
					break;
				}
			}
			for(var no=0;no<returnDateToMinute.options.length;no++){
				if(returnDateToMinute.options[no].value==parseInt(currentMinute)){
					returnDateToMinute.selectedIndex=no;
					break;
				}
			}
		}
	}
	closeCalendar();

}

// This function is from http://www.codeproject.com/csharp/gregorianwknum.asp
// Only changed the month add
function getWeek(year,month,day){
   if (! weekStartsOnSunday) {
	   day = (day/1);
	} else {
	   day = (day/1)+1;
	}
	year = year /1;
    month = month/1 + 1; //use 1-12
    var a = Math.floor((14-(month))/12);
    var y = year+4800-a;
    var m = (month)+(12*a)-3;
    var jd = day + Math.floor(((153*m)+2)/5) +
                 (365*y) + Math.floor(y/4) - Math.floor(y/100) +
                 Math.floor(y/400) - 32045;      // (gregorian calendar)
    var d4 = (jd+31741-(jd%7))%146097%36524%1461;
    var L = Math.floor(d4/1460);
    var d1 = ((d4-L)%365)+L;
    NumberOfWeek = Math.floor(d1/7) + 1;
    return NumberOfWeek;
}

function writeTimeBar()
{
	var timeBar = document.createElement('DIV');
	timeBar.id = 'timeBar';
	timeBar.className = 'timeBar';

	var subDiv = document.createElement('DIV');
	subDiv.innerHTML = 'Time:';
	//timeBar.appendChild(subDiv);

	// Year selector
	var hourDiv = document.createElement('DIV');
	hourDiv.onmouseover = highlightSelect;
	hourDiv.onmouseout = highlightSelect;
	hourDiv.onclick = showHourDropDown;
	hourDiv.style.width = '30px';
	var span = document.createElement('SPAN');
	span.innerHTML = currentHour;
	span.id = 'calendar_hour_txt';
	hourDiv.appendChild(span);
	timeBar.appendChild(hourDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down_time.gif';
	hourDiv.appendChild(img);
	hourDiv.className = 'selectBoxTime';

	if(Opera){
		hourDiv.style.width = '30px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var hourPicker = createHourDiv();
	hourPicker.style.left = '130px';
	//hourPicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	hourPicker.style.width = '35px';
	hourPicker.id = 'hourDropDown';
	calendarDiv.appendChild(hourPicker);

	// Add Minute picker

	// Year selector
	var minuteDiv = document.createElement('DIV');
	minuteDiv.onmouseover = highlightSelect;
	minuteDiv.onmouseout = highlightSelect;
	minuteDiv.onclick = showMinuteDropDown;
	minuteDiv.style.width = '30px';
	var span = document.createElement('SPAN');
	span.innerHTML = currentMinute;

	span.id = 'calendar_minute_txt';
	minuteDiv.appendChild(span);
	timeBar.appendChild(minuteDiv);

	var img = document.createElement('IMG');
	img.src = pathToImages + 'down_time.gif';
	minuteDiv.appendChild(img);
	minuteDiv.className = 'selectBoxTime';

	if(Opera){
		minuteDiv.style.width = '30px';
		img.style.cssText = 'float:right';
		img.style.position = 'relative';
		img.style.styleFloat = 'right';
	}

	var minutePicker = createMinuteDiv();
	minutePicker.style.left = '167px';
	//minutePicker.style.top = monthDiv.offsetTop + monthDiv.offsetHeight + 1 + 'px';
	minutePicker.style.width = '35px';
	minutePicker.id = 'minuteDropDown';
	calendarDiv.appendChild(minutePicker);


	return timeBar;

}

function writeBottomBar()
{
	var d = new Date();
	var bottomBar = document.createElement('DIV');

	bottomBar.id = 'bottomBar';

	bottomBar.style.cursor = 'pointer';
	bottomBar.className = 'todaysDate';
	// var todayStringFormat = '[todayString] [dayString] [day] [monthString] [year]';	;;

	var subDiv = document.createElement('DIV');
	subDiv.onclick = pickTodaysDate;
	subDiv.id = 'todaysDateString';
	subDiv.style.width = (calendarDiv.offsetWidth - 95) + 'px';
	var day = d.getDay();
	if (! weekStartsOnSunday) {
      if(day==0)day = 7;
      day--;
   }

	var bottomString = todayStringFormat;
	bottomString = bottomString.replace('[monthString]',monthArrayShort[d.getMonth()]);
	bottomString = bottomString.replace('[day]',d.getDate());
	bottomString = bottomString.replace('[year]',d.getFullYear());
	bottomString = bottomString.replace('[dayString]',dayArray[day].toLowerCase());
	bottomString = bottomString.replace('[UCFdayString]',dayArray[day]);
	bottomString = bottomString.replace('[todayString]',todayString);


	subDiv.innerHTML = todayString + ': ' + d.getDate() + '. ' + monthArrayShort[d.getMonth()] + ', ' +  d.getFullYear() ;
	subDiv.innerHTML = bottomString ;
	bottomBar.appendChild(subDiv);

	var timeDiv = writeTimeBar();
	bottomBar.appendChild(timeDiv);

	calendarDiv.appendChild(bottomBar);



}
function getTopPos(inputObj)
{

  var returnValue = inputObj.offsetTop + inputObj.offsetHeight;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetTop;
  return returnValue + calendar_offsetTop;
}

function getleftPos(inputObj)
{
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft;
  return returnValue + calendar_offsetLeft;
}

function positionCalendar(inputObj)
{
	calendarDiv.style.left = getleftPos(inputObj) + 'px';
	calendarDiv.style.top = getTopPos(inputObj) + 'px';
	if(iframeObj){
		iframeObj.style.left = calendarDiv.style.left;
		iframeObj.style.top =  calendarDiv.style.top;
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2.style.left = calendarDiv.style.left;
		iframeObj2.style.top =  calendarDiv.style.top;
	}

}

function initCalendar()
{
	if(MSIE){
		iframeObj = document.createElement('IFRAME');
		iframeObj.style.filter = 'alpha(opacity=0)';
		iframeObj.style.position = 'absolute';
		iframeObj.border='0px';
		iframeObj.style.border = '0px';
		iframeObj.style.backgroundColor = '#FF0000';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2 = document.createElement('IFRAME');
		iframeObj2.style.position = 'absolute';
		iframeObj2.border='0px';
		iframeObj2.style.border = '0px';
		iframeObj2.style.height = '1px';
		iframeObj2.style.width = '1px';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		// Added fixed for HTTPS
		iframeObj2.src = 'http://www.visitithaca.com/admin/';
		iframeObj.src = 'http://www.visitithaca.com/admin/';
		document.body.appendChild(iframeObj2);  // gfb move this down AFTER the .src is set
		document.body.appendChild(iframeObj);
	}

	calendarDiv = document.createElement('DIV');
	calendarDiv.id = 'calendarDiv';
	calendarDiv.style.zIndex = 1000;
	slideCalendarSelectBox();

	document.body.appendChild(calendarDiv);
	writeBottomBar();
	writeTopBar();



	if(!currentYear){
		var d = new Date();
		currentMonth = d.getMonth();
		currentYear = d.getFullYear();
	}
	writeCalendarContent();



}

function setTimeProperties()
{
	if(!calendarDisplayTime){
		document.getElementById('timeBar').style.display='none';
		document.getElementById('timeBar').style.visibility='hidden';
		document.getElementById('todaysDateString').style.width = '100%';


	}else{
		document.getElementById('timeBar').style.display='block';
		document.getElementById('timeBar').style.visibility='visible';
		document.getElementById('hourDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
		document.getElementById('minuteDropDown').style.top = document.getElementById('calendar_minute_txt').parentNode.offsetHeight + calendarContentDiv.offsetHeight + document.getElementById('topBar').offsetHeight + 'px';
		document.getElementById('minuteDropDown').style.right = '50px';
		document.getElementById('hourDropDown').style.right = '50px';
		document.getElementById('todaysDateString').style.width = '115px';
	}
}

function calendarSortItems(a,b)
{
	return a/1 - b/1;
}


function displayCalendar(inputField,format,buttonObj,displayTime,timeInput)
{
	if(displayTime)calendarDisplayTime=true; else calendarDisplayTime = false;
	
	if(inputField.value.length>6){ //dates must have at least 6 digits...
       if(!inputField.value.match(/^[0-9]*?$/gi)){
 			var items = inputField.value.split(/[^0-9]/gi);
			var positionArray = new Array();
			positionArray['m'] = format.indexOf('mm');
			if(positionArray['m']==-1)positionArray['m'] = format.indexOf('m');
			positionArray['d'] = format.indexOf('dd');
			if(positionArray['d']==-1)positionArray['d'] = format.indexOf('d');
			positionArray['y'] = format.indexOf('yyyy');
			positionArray['h'] = format.indexOf('hh');
			positionArray['i'] = format.indexOf('ii');

			var positionArrayNumeric = Array();
			positionArrayNumeric[0] = positionArray['m'];
			positionArrayNumeric[1] = positionArray['d'];
			positionArrayNumeric[2] = positionArray['y'];
			positionArrayNumeric[3] = positionArray['h'];
			positionArrayNumeric[4] = positionArray['i'];


			positionArrayNumeric = positionArrayNumeric.sort(calendarSortItems);
			var itemIndex = -1;
			currentHour = '00';
			currentMinute = '00';
			for(var no=0;no<positionArrayNumeric.length;no++){
				if(positionArrayNumeric[no]==-1)continue;
				itemIndex++;
				if(positionArrayNumeric[no]==positionArray['m']){
					currentMonth = items[itemIndex]-1;
					continue;
				}
				if(positionArrayNumeric[no]==positionArray['y']){
					currentYear = items[itemIndex];
					continue;
				}
				if(positionArrayNumeric[no]==positionArray['d']){
					tmpDay = items[itemIndex];
					continue;
				}
				if(positionArrayNumeric[no]==positionArray['h']){
					currentHour = items[itemIndex];
					continue;
				}
				if(positionArrayNumeric[no]==positionArray['i']){
					currentMinute = items[itemIndex];
					continue;
				}
			}

			currentMonth = currentMonth / 1;
			tmpDay = tmpDay / 1;
		}else{
			var monthPos = format.indexOf('mm');
			currentMonth = inputField.value.substr(monthPos,2)/1 -1;
			var yearPos = format.indexOf('yyyy');
			currentYear = inputField.value.substr(yearPos,4);
			var dayPos = format.indexOf('dd');
			tmpDay = inputField.value.substr(dayPos,2);

			var hourPos = format.indexOf('hh');
			if(hourPos>=0){
				tmpHour = inputField.value.substr(hourPos,2);
				currentHour = tmpHour;
			}else{
				currentHour = '00';
			}
			var minutePos = format.indexOf('ii');
			if(minutePos>=0){
				tmpMinute = inputField.value.substr(minutePos,2);
				currentMinute = tmpMinute;
			}else{
				currentMinute = '00';
			}
		}
	}else{
		var d = new Date();
		currentMonth = d.getMonth();
		currentYear = d.getFullYear();
		currentHour = '08';
		currentMinute = '00';
		tmpDay = d.getDate();
	}

	inputYear = currentYear;
	inputMonth = currentMonth;
	inputDay = tmpDay/1;


	if(!calendarDiv){
		initCalendar();
	}else{
		if(calendarDiv.style.display=='block'){
			closeCalendar();
			return false;
		}
		writeCalendarContent();
	}



	returnFormat = format;
	returnDateTo = inputField;
	positionCalendar(buttonObj);
	calendarDiv.style.visibility = 'visible';
	calendarDiv.style.display = 'block';
	if(iframeObj){
		iframeObj.style.display = '';
		iframeObj.style.height = '140px';
		iframeObj.style.width = '195px';
				iframeObj2.style.display = '';
		iframeObj2.style.height = '140px';
		iframeObj2.style.width = '195px';
	}

	setTimeProperties();
	updateYearDiv();
	updateMonthDiv();
	updateMinuteDiv();
	updateHourDiv();

}

function displayCalendarSelectBox(yearInput,monthInput,dayInput,hourInput,minuteInput,buttonObj)
{
	if(!hourInput)calendarDisplayTime=false; else calendarDisplayTime = true;

	currentMonth = monthInput.options[monthInput.selectedIndex].value/1-1;
	currentYear = yearInput.options[yearInput.selectedIndex].value;
	if(hourInput){
		currentHour = hourInput.options[hourInput.selectedIndex].value;
		inputHour = currentHour/1;
	}
	if(minuteInput){
		currentMinute = minuteInput.options[minuteInput.selectedIndex].value;
		inputMinute = currentMinute/1;
	}

	inputYear = yearInput.options[yearInput.selectedIndex].value;
	inputMonth = monthInput.options[monthInput.selectedIndex].value/1 - 1;
	inputDay = dayInput.options[dayInput.selectedIndex].value/1;

	if(!calendarDiv){
		initCalendar();
	}else{
		writeCalendarContent();
	}



	returnDateToYear = yearInput;
	returnDateToMonth = monthInput;
	returnDateToDay = dayInput;
	returnDateToHour = hourInput;
	returnDateToMinute = minuteInput;




	returnFormat = false;
	returnDateTo = false;
	positionCalendar(buttonObj);
	calendarDiv.style.visibility = 'visible';
	calendarDiv.style.display = 'block';
	if(iframeObj){
		iframeObj.style.display = '';
		iframeObj.style.height = calendarDiv.offsetHeight + 'px';
		iframeObj.style.width = calendarDiv.offsetWidth + 'px';
		//// fix for EI frame problem on time dropdowns 09/30/2006
		iframeObj2.style.display = '';
		iframeObj2.style.height = calendarDiv.offsetHeight + 'px';
		iframeObj2.style.width = calendarDiv.offsetWidth + 'px'
	}
	setTimeProperties();
	updateYearDiv();
	updateMonthDiv();
	updateHourDiv();
	updateMinuteDiv();

}
// SWFObject v1.5
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

//mootools
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('F 9S={\'2O\':\'1.2.0\',\'7J\':\'\'};F 1i=E(e){e=e||{};F f=e.4Z||E(){};F g=e.7K;g=(g!==O);F h=e.51;F i=e.1q;F j=e.7L;F k=e.1a;F l=i||h;l.52=1i;l.$2u={1a:\'7M\'};G(h&&i)l.1t=h.1t;l.1t.52=l;G(k){F m=k.22();l.1t.$2u={1a:m};1i.6k(l,m)}F n=E(a,b,c,d){G(!j||d||!a.1t[b])a.1t[b]=c;G(g)1i.6l(a,b,j);f.1f(a,b,c);C a};l.1b=E(a,b,c){G(1T a==\'1G\')C n(B,a,b,c);J(F p 12 a)n(B,p,a[p],b);C B};l.30=E(b,c,d){G(1T b==\'1G\'){b=B.1t[b];G(b)n(B,c,b,d)}1j{J(F a 12 b)B.30(a,b[a],c)}C B};C l};1i.1b=E(a,b){J(F i=0,l=a.P;i<l;i++)a[i].1b(b)};1i.6l=E(b,c,d){G((!d||!b[c])&&1T b.1t[c]==\'E\')b[c]=E(){F a=1g.1t.23.1f(M);C b.1t[c].25(a.4h(),a)}};1i.6k=E(b,c){G(!b.V)b.V=E(a){C($V(a)===c)}};1i.30=E(a,b,c,d){J(F i=0,j=a.P;i<j;i++)a[i].30(b,c,d)};(E(a){J(F b 12 a)1i.6k(a[b],b)})({\'7N\':9T,\'7M\':1i,\'1H\':53});(E(a){J(F b 12 a)K 1i({1a:b,1q:a[b],7L:N})})({\'1I\':1I,\'6m\':6m,\'2E\':2E,\'1g\':1g,\'4i\':4i,\'4j\':4j});(E(a,b){J(F i=b.P;i--;i)1i.6l(a,b[i],N);C M.2m})(1g,[\'9U\',\'1n\',\'9V\',\'4h\',\'9W\',\'54\',\'9X\',\'3n\',\'3o\',\'23\',\'55\',\'7O\',\'31\',\'7P\'])(1I,[\'56\',\'6n\',\'3n\',\'31\',\'7P\',\'1r\',\'1u\',\'3D\',\'23\',\'3p\',\'6o\',\'9Y\',\'22\',\'57\',\'7O\']);E $2v(a){C!!(a||a===0)};E $7Q(a){9Z(a);a0(a);C T};E $33(a){C(a!=2b)};E $1x(){};E $M(i){C E(){C M[i]}};E $6p(a){C(1T a==\'E\')?a:E(){C a}};E $1k(a,b){J(F c 12(b||{}))a[c]=b[c];C a};E $3q(a){F b;1J($V(a)){R\'1H\':b={};J(F p 12 a)b[p]=$3q(a[p]);1l;R\'58\':b=$3q(a.6q());1l;R\'3E\':b=[];J(F i=0,l=a.P;i<l;i++)b[i]=$3q(a[i]);1l;3F:C a}C b};E $4k(){F a={};J(F i=0,l=M.P;i<l;i++){F b=M[i];G($V(b)!=\'1H\')2c;J(F c 12 b){F d=b[c],59=a[c];a[c]=(59&&$V(d)==\'1H\'&&$V(59)==\'1H\')?$4k(59,d):$3q(d)}}C a};E $5a(){J(F i=0,l=M.P;i<l;i++){G(M[i]!=2b)C M[i]}C T};E $6r(a,b){C 1h.6s(1h.6r()*(b-a+1)+a)};E $2P(a){F b=$V(a);C(b)?((b!=\'3E\'&&b!=\'M\')?[a]:a):[]};F $2d=4j.a1||E(){C K 4j().7R()};E $2o(){J(F i=0,l=M.P;i<l;i++){2o{C M[i]()}a2(e){}}C T};E $V(a){G(a==2b)C O;G(a.$2u)C(a.$2u.1a==\'4l\'&&!a3(a))?O:a.$2u.1a;G(a.6t){1J(a.2w){R 1:C\'1y\';R 3:C(/\\S/).1K(a.6u)?\'6v\':\'7S\'}}1j G(1T a.P==\'4l\'){G(a.2m)C\'M\';1j G(a.34)C\'6w\'}C 1T a};F W=K 1i({1a:\'W\',1q:E(a){G($V(a)==\'58\')a=$3q(a.6q());J(F b 12 a)B[b]=a[b];C B}});W.1b({a4:E(){F a=0;J(F b 12 B){G(B.2F(b))a++}C a},5b:E(a,b){J(F c 12 B){G(B.2F(c))a.1f(b,B[c],c,B)}},6q:E(){F a={};J(F b 12 B){G(B.2F(b))a[b]=B[b]}C a}});W.30(\'5b\',\'14\');E $H(a){C K W(a)};1g.1b({5b:E(a,b){J(F i=0,l=B.P;i<l;i++)a.1f(b,B[i],i,B)}});1g.30(\'5b\',\'14\');E $A(a){G(a.34){F b=[];J(F i=0,l=a.P;i<l;i++)b[i]=a[i];C b}C 1g.1t.23.1f(a)};E $14(a,b,c){F d=$V(a);((d==\'M\'||d==\'6w\'||d==\'3E\')?1g:W).14(a,b,c)};F Q=K W({15:{1a:\'a5\',2O:\'\'},5c:{1a:(6x.a6.1r(/a7|a8|a9/i)||[\'aa\'])[0].22()},6y:{7T:!!(1d.ab),ac:!!(1o.ad)},7U:{}});G(1o.ae)Q.15={1a:\'5d\',2O:(1d.7V)?af:ag};1j G(1o.5e)Q.15={1a:\'1z\',2O:(1o.6z)?5:4};1j G(!6x.ah)Q.15={1a:\'3G\',2O:(Q.6y.7T)?ai:aj};1j G(1d.ak!=T)Q.15={1a:\'4m\',2O:(1d.7V)?19:18};Q.15[Q.15.1a]=Q.15[Q.15.1a+Q.15.2O]=N;G(1o.al!=2b)Q.5c.1a=\'am\';Q.5c[Q.5c.1a]=N;Q.2e=E(){C $2o(E(){C K 6z()},E(){C K 5e(\'ap.aq\')})};Q.6y.1Q=!!(Q.2e());Q.7U.7W=(E(){F a=($2o(E(){C 6x.ar[\'as 7W\'].at},E(){C K 5e(\'7X.7X\').au(\'$2O\')})||\'0 aw\').1r(/\\d+/g);C{2O:3r(a[0]||0+\'.\'+a[1]||0),7J:3r(a[2]||0)}})();E $4n(a){G(!a)C a;G(1o.7Y){1o.7Y(a)}1j{F b=1d.5f(\'5g\');b.7Z(\'V\',\'2G/3H\');b.2G=a;1d.5h.3I(b);1d.5h.80(b)}C a};1i.6A=1;F $1A=(Q.15.1z)?E(a){C(a.1A||(a.1A=[1i.6A++]))[0]}:E(a){C a.1A||(a.1A=1i.6A++)};F 2f=K 1i({1a:\'2f\',51:(Q.15.1z)?T:1o.2f,1q:E(a){$1A(a);G(!a.I){a.I=$1x;G(Q.15.3G)a.1d.5f("5i");a.I.1t=(Q.15.3G)?1o["[[ax.1t]]"]:{}}C $1k(a,2f.2H)},4Z:E(a,b){1o[a]=2f.2H[a]=b}});2f.2H={$2u:{1a:\'1o\'}};K 2f(1o);F 1U=K 1i({1a:\'1U\',51:(Q.15.1z)?T:1o.1U,1q:E(a){$1A(a);a.5h=a.35(\'5h\')[0];a.26=a.35(\'26\')[0];a.1o=a.81||a.82;G(Q.15.ay)$2o(E(){a.az("aA",O,N)});C $1k(a,1U.2H)},4Z:E(a,b){1d[a]=1U.2H[a]=b}});1U.2H={$2u:{1a:\'1d\'}};K 1U(1d);1g.1b({83:E(a,b){J(F i=0,l=B.P;i<l;i++){G(!a.1f(b,B[i],i,B))C O}C N},1V:E(a,b){F c=[];J(F i=0,l=B.P;i<l;i++){G(a.1f(b,B[i],i,B))c.1n(B[i])}C c},5j:E(){C B.1V($33)},31:E(a,b){F c=B.P;J(F i=(b<0)?1h.4o(0,c+b):b||0;i<c;i++){G(B[i]===a)C i}C-1},2p:E(a,b){F c=[];J(F i=0,l=B.P;i<l;i++)c[i]=a.1f(b,B[i],i,B);C c},84:E(a,b){J(F i=0,l=B.P;i<l;i++){G(a.1f(b,B[i],i,B))C N}C O},5k:E(a){F b={},P=1h.5l(B.P,a.P);J(F i=0;i<P;i++)b[a[i]]=B[i];C b},2g:E(a){F b={};J(F i=0,l=B.P;i<l;i++){J(F c 12 a){G(a[c](B[i])){b[c]=B[i];1R a[c];1l}}}C b},1B:E(a,b){C B.31(a,b)!=-1},1k:E(a){J(F i=0,j=a.P;i<j;i++)B.1n(a[i]);C B},85:E(){C(B.P)?B[B.P-1]:T},aB:E(){C(B.P)?B[$6r(0,B.P-1)]:T},4p:E(a){G(!B.1B(a))B.1n(a);C B},6B:E(a){J(F i=0,l=a.P;i<l;i++)B.4p(a[i]);C B},36:E(a){J(F i=B.P;i--;i){G(B[i]===a)B.54(i,1)}C B},1x:E(){B.P=0;C B},3J:E(){F a=[];J(F i=0,l=B.P;i<l;i++){F b=$V(B[i]);G(!b)2c;a=a.3n((b==\'3E\'||b==\'6w\'||b==\'M\')?1g.3J(B[i]):B[i])}C a},5m:E(b){G(B.P!=3)C T;F c=B.2p(E(a){G(a.P==1)a+=a;C a.3s(16)});C(b)?c:\'2h(\'+c+\')\'},4q:E(a){G(B.P<3)C T;G(B.P==4&&B[3]==0&&!a)C\'6C\';F b=[];J(F i=0;i<3;i++){F c=(B[i]-0).55(16);b.1n((c.P==1)?\'0\'+c:c)}C(a)?b:\'#\'+b.3o(\'\')}});6m.1b({1k:E(a){J(F b 12 a)B[b]=a[b];C B},2I:E(d){F e=B;d=d||{};C E(a){F b=d.M;b=(b!=2b)?$2P(b):1g.23(M,(d.2q)?1:0);G(d.2q)b=[a||1o.2q].1k(b);F c=E(){C e.25(d.1O||T,b)};G(d.3a)C aC(c,d.3a);G(d.4r)C aD(c,d.4r);G(d.5n)C $2o(c);C c()}},aE:E(a,b){C B.2I({M:a,1O:b})},5n:E(a,b){C B.2I({M:a,1O:b,5n:N})()},1O:E(a,b){C B.2I({1O:a,M:b})},aF:E(a,b){C B.2I({1O:a,2q:N,M:b})},3a:E(a,b,c){C B.2I({3a:a,1O:b,M:c})()},4r:E(a,b,c){C B.2I({4r:a,1O:b,M:c})()},86:E(a,b){C B.25(b,$2P(a))}});2E.1b({aG:E(a,b){C 1h.5l(b,1h.4o(a,B))},3K:E(a){a=1h.3b(10,a||0);C 1h.3K(B*a)/a},6D:E(a,b){J(F i=0;i<B;i++)a.1f(b,i,B)},87:E(){C 5o(B)},3s:E(a){C 3r(B,a||10)}});2E.30(\'6D\',\'14\');(E(b){F c={};b.14(E(a){G(!2E[a])c[a]=E(){C 1h[a].25(T,[B].3n($A(M)))}});2E.1b(c)})([\'aH\',\'88\',\'aI\',\'aJ\',\'aK\',\'aL\',\'6E\',\'aM\',\'6s\',\'aN\',\'4o\',\'5l\',\'3b\',\'6F\',\'aO\',\'aP\']);1I.1b({1K:E(a,b){C((1T a==\'1G\')?K 4i(a,b):a).1K(B)},1B:E(a,b){C(b)?(b+B+b).31(b+a+b)>-1:B.31(a)>-1},5p:E(){C B.1u(/^\\s+|\\s+$/g,\'\')},5j:E(){C B.1u(/\\s+/g,\' \').5p()},5q:E(){C B.1u(/-\\D/g,E(a){C a.56(1).57()})},89:E(){C B.1u(/[A-Z]/g,E(a){C(\'-\'+a.56(0).22())})},3L:E(){C B.1u(/\\b[a-z]/g,E(a){C a.57()})},8a:E(){C B.1u(/([-.*+?^${}()|[\\]\\/\\\\])/g,\'\\\\$1\')},3s:E(a){C 3r(B,a||10)},87:E(){C 5o(B)},5m:E(a){F b=B.1r(/^#?(\\w{1,2})(\\w{1,2})(\\w{1,2})$/);C(b)?b.23(1).5m(a):T},4q:E(a){F b=B.1r(/\\d{1,3}/g);C(b)?b.4q(a):T},6G:E(a){F b=\'\';F c=B.1u(/<5g[^>]*>([\\s\\S]*?)<\\/5g>/aQ,E(){b+=M[1]+\'\\n\';C\'\'});G(a===N)$4n(b);1j G($V(a)==\'E\')a(b,c);C c},aR:E(c,d){C B.1u(d||(/\\\\?\\{([^}]+)\\}/g),E(a,b){G(a.56(0)==\'\\\\\')C a.23(1);C(c[b]!=2b)?c[b]:\'\'})}});W.1b({aS:53.1t.2F,5r:E(a){J(F b 12 B){G(B.2F(b)&&B[b]===a)C b}C T},4s:E(a){C(W.5r(B,a)!==T)},1k:E(c){W.14(c,E(a,b){W.1c(B,b,a)},B);C B},6B:E(c){W.14(c,E(a,b){W.4p(B,b,a)},B);C B},36:E(a){G(B.2F(a))1R B[a];C B},Y:E(a){C(B.2F(a))?B[a]:T},1c:E(a,b){G(!B[a]||B.2F(a))B[a]=b;C B},1x:E(){W.14(B,E(a,b){1R B[b]},B);C B},4p:E(a,b){F k=B[a];G(k==2b)B[a]=b;C B},2p:E(c,d){F e=K W;W.14(B,E(a,b){e.1c(b,c.1f(d,a,b,B))},B);C e},1V:E(c,d){F e=K W;W.14(B,E(a,b){G(c.1f(d,a,b,B))e.1c(b,a)},B);C e},83:E(a,b){J(F c 12 B){G(B.2F(c)&&!a.1f(b,B[c],c))C O}C N},84:E(a,b){J(F c 12 B){G(B.2F(c)&&a.1f(b,B[c],c))C N}C O},aT:E(){F c=[];W.14(B,E(a,b){c.1n(b)});C c},aU:E(){F b=[];W.14(B,E(a){b.1n(a)});C b},3t:E(f){F g=[];W.14(B,E(b,c){G(f)c=f+\'[\'+c+\']\';F d;1J($V(b)){R\'1H\':d=W.3t(b,c);1l;R\'3E\':F e={};b.14(E(a,i){e[i]=a});d=W.3t(e,c);1l;3F:d=c+\'=\'+6H(b)}G(b!=2b)g.1n(d)});C g.3o(\'&\')}});W.30({5r:\'31\',4s:\'1B\'});F 3M=K 1i({1a:\'3M\',1q:E(a,b){b=b||1o;F c=b.1d;a=a||b.2q;G(a.$8b)C a;B.$8b=N;F d=a.V;F e=a.8c||a.aV;1L(e&&e.2w==3)e=e.1C;G(d.1K(/1p/)){F f=a.8d||a.aW;F g=3M.8e.5r(f);G(d==\'8f\'){F h=f-aX;G(h>0&&h<13)g=\'f\'+h}g=g||1I.aY(f).22()}1j G(d.1r(/(8g|aZ|b0)/i)){c=(!c.5s||c.5s==\'8h\')?c.26:c.3N;F i={x:a.6I||a.8i+c.4t,y:a.6J||a.8j+c.4u};F j={x:(a.6I)?a.6I-b.8k:a.8i,y:(a.6J)?a.6J-b.8l:a.8j};G(d.1r(/6K|5t/)){F k=(a.8m)?a.8m/b1:-(a.b2||0)/3}F l=(a.8d==3)||(a.b3==2);F m=T;G(d.1r(/b4|8n/)){1J(d){R\'6L\':m=a.5u||a.b5;1l;R\'6M\':m=a.5u||a.3u}G(!(E(){1L(m&&m.2w==3)m=m.1C;C N}).2I({5n:Q.15.4m})())m=O}}C $1k(B,{2q:a,V:d,b6:i,b7:j,b8:l,b9:k,5u:m,8c:e,ba:f,1p:g,4h:a.bb,bc:a.bd,be:a.bf,bg:a.bh})}});3M.8e=K W({\'bi\':13,\'bj\':38,\'bk\':40,\'2J\':37,\'4v\':39,\'bl\':27,\'bm\':32,\'bn\':8,\'bo\':9,\'1R\':46});3M.1b({8o:E(){C B.5v().5w()},5v:E(){G(B.2q.5v)B.2q.5v();1j B.2q.bp=N;C B},5w:E(){G(B.2q.5w)B.2q.5w();1j B.2q.bq=O;C B}});F 1v=K 1i({1a:\'1v\',1q:E(e){e=e||{};F f=E(a){J(F b 12 B)B[b]=$3q(B[b]);J(F c 12 1v.5x){G(!B[c])2c;1v.5x[c](B,B[c]);1R B[c]}B.52=f;G(a===$1x)C B;F d=(B.1q)?B.1q.25(B,M):B;G(B.L&&B.L.1q)B.L.1q.1f(B);C d};$1k(f,B);f.52=1v;f.1t=e;C f}});1v.1b({1b:E(){1v.5x.3O(B.1t,1g.23(M));C B}});1v.5x={3O:E(b,c){$2P(c).14(E(a){$1k(b,($V(a)==\'8p\')?K a($1x):a)})},3P:E(c,d){F e=K d($1x);1R e.2Q;1R e.8q;J(F f 12 e){F g=c[f],4w=e[f];G(g==2b){c[f]=4w;2c}F h=$V(g),8r=$V(4w);G(h!=8r)2c;1J(h){R\'E\':G(!M.2m.8s)c[f]=6N(\'(\'+1I(g).1u(/\\br\\.2Q\\(\\s*(\\))?/g,E(a,b){C\'M.2m.5y.1f(B\'+(b||\', \')})+\')\');c[f].5y=4w;1l;R\'1H\':c[f]=$4k(4w,g)}}c.2Q=E(){C M.2m.8s.5y.25(B,M)};c.8q=E(a){C a.5y.25(B,1g.23(M,1))}}};F 6O=K 1v({2i:E(){B.$2i=(B.$2i||[]).1k(M);C B},5z:E(){C(B.$2i&&B.$2i.P)?B.$2i.4h().25(B,M):O},8t:E(){G(B.$2i)B.$2i.1x();C B}});F 2x=K 1v({2R:E(a,b,c){a=2x.5A(a);G(b!=$1x){B.$1D=B.$1D||{};B.$1D[a]=B.$1D[a]||[];B.$1D[a].4p(b);G(c)b.8u=N}C B},6P:E(a){J(F b 12 a)B.2R(b,a[b]);C B},1W:E(b,c,d){b=2x.5A(b);G(!B.$1D||!B.$1D[b])C B;B.$1D[b].14(E(a){a.2I({\'1O\':B,\'3a\':d,\'M\':c})()},B);C B},5B:E(a,b){a=2x.5A(a);G(!B.$1D||!B.$1D[a])C B;G(!b.8u)B.$1D[a].36(b);C B},4x:E(a){J(F e 12 B.$1D){G(a&&a!=e)2c;F b=B.$1D[e];J(F i=b.P;i--;i)B.5B(e,b[i])}C B}});2x.5A=E(c){C c.1u(/^5C([A-Z])/,E(a,b){C b.22()})};F 4y=K 1v({4z:E(){B.L=$4k.86([B.L].1k(M));G(!B.2R)C B;J(F a 12 B.L){G($V(B.L[a])!=\'E\'||!(/^5C[A-Z]/).1K(a))2c;B.2R(a,B.L[a]);1R B.L[a]}C B}});1U.1b({8v:E(b,c){G(Q.15.1z&&c){[\'1a\',\'V\',\'5D\'].14(E(a){G(!c[a])C;b+=\' \'+a+\'="\'+c[a]+\'"\';G(a!=\'5D\')1R c[a]});b=\'<\'+b+\'>\'}C $.1y(B.5f(b)).1c(c)},6Q:E(a){C B.bs(a)},4A:E(){C B},2j:E(){C B.81||B.82},8w:E(){F a=B.35(\'*\');J(F i=0,l=a.P;i<l;i++)Q.5E(a[i])}});F I=K 1i({1a:\'I\',51:1o.I,1q:E(a,b){F c=I.8x.Y(a);G(c)C c(b);G(1T a==\'1G\')C 1d.8v(a,b);C $(a).1c(b)},4Z:E(a,b){G(!1g[a])2r.1b(a,2r.8y(a));I.2H[a]=b}});I.2H={$2u:{1a:\'1y\'}};I.8x=K W;F 8z=K 1i({1a:\'8z\',7K:O,1q:E(){F d=1g.2g(M,{5F:53.V,5i:$33});F e=d.5F||{};F f=$(d.5i)||O;F g=e.8A||$1x;1R e.8A;e.1M=e.1a=$5a(e.1M,e.1a,f.1M,f.1a,\'bt\'+$2d());f=K I(f||\'5i\',e);F h=E(){F a=$2o(E(){C f.4B.5G.6R});G(a&&a==1o.5G.6R){F b=K 2f(f.4B);F c=K 1U(f.4B.1d);$1k(b.I.1t,I.2H)}g.1f(f.4B,f.4B.1d)};(!1o.bu[e.1M])?f.5H(\'1X\',h):h();C f}});F 2r=K 1i({1q:E(a,b){b=$1k({3Q:N,3v:N},b);a=a||[];G(b.3Q||b.3v){F c={},6S=[];J(F i=0,l=a.P;i<l;i++){F d=$.1y(a[i],!b.3v);G(b.3Q){G(c[d.1A])2c;c[d.1A]=N}6S.1n(d)}a=6S}C(b.3v)?$1k(a,B):a}});2r.1b({1V:E(b,c){G(!b)C B;C K 2r(1g.1V(B,(1T b==\'1G\')?E(a){C a.1r(b)}:b,c))}});2r.8y=E(d){C E(){F a=[];F b=N;J(F i=0,j=B.P;i<j;i++){F c=B[i][d].25(B[i],M);a.1n(c);G(b)b=($V(c)==\'1y\')}C(b)?K 2r(a):a}};2f.1b({$:E(a,b){G(a&&a.$2u&&a.1A)C a;F c=$V(a);C($[c])?$[c](a,b,B.1d):T},$$:E(a){G(M.P==1&&1T a==\'1G\')C B.1d.3w(a);F b=[];F c=1g.3J(M);J(F i=0,l=c.P;i<l;i++){F d=c[i];1J($V(d)){R\'1y\':d=[d];1l;R\'1G\':d=B.1d.3w(d,N);1l;3F:d=O}G(d)b.1k(d)}C K 2r(b)},4A:E(){C B.1d},2j:E(){C B}});$.1G=E(a,b,c){a=c.3R(a);C(a)?$.1y(a,b):T};$.1y=E(a,b){$1A(a);G(!b&&!a.$2u&&!(/^1H|bv$/i).1K(a.2S)){F c=I.2H;J(F p 12 c)a[p]=c[p]};C a};$.1H=E(a,b,c){G(a.3u)C $.1y(a.3u(c),b);C T};$.6v=$.7S=$.1o=$.1d=$M(0);1i.1b([I,1U],{bw:E(a,b){C $(B.3w(a,N)[0]||T,b)},3w:E(c,d){c=c.3p(\',\');F e=[];F f=(c.P>1);c.14(E(a){F b=B.35(a.5p());(f)?e.1k(b):e=b},B);C K 2r(e,{3Q:f,3v:!d})}});I.5I={Y:E(a){C(B[a]||(B[a]={}))}};I.3S=K W({bx:E(a,b){G(b.1C)b.1C.6T(a,b)},by:E(a,b){G(!b.1C)C;F c=b.2T;(c)?b.1C.6T(a,c):b.1C.3I(a)},3c:E(a,b){b.3I(a)},2U:E(a,b){F c=b.5J;(c)?b.6T(a,c):b.3I(a)}});I.3S.bz=I.3S.3c;I.3S.14(E(b,c){F d=c.3L();I.1b(\'5K\'+d,E(a){b(B,$(a,N));C B});I.1b(\'3T\'+d,E(a){b($(a,N),B);C B})});I.1b({4A:E(){C B.6U},2j:E(){C B.6U.2j()},3R:E(a,b){F c=B.6U.3R(a);G(!c)C T;J(F d=c.1C;d!=B;d=d.1C){G(!d)C T}C $.1y(c,b)},1c:E(a,b){1J($V(a)){R\'1H\':J(F p 12 a)B.1c(p,a[p]);1l;R\'1G\':F c=I.1Y.Y(a);(c&&c.1c)?c.1c.25(B,1g.23(M,1)):B.6V(a,b)}C B},Y:E(a){F b=I.1Y.Y(a);C(b&&b.Y)?b.Y.25(B,1g.23(M,1)):B.5L(a)},36:E(a){F b=I.1Y.Y(a);(b&&b.36)?b.36.25(B,1g.23(M,1)):B.5M(a);C B},1r:E(a){C(!a||I.Y(B,\'5N\')==a)},5K:E(a,b){I.3S.Y(b||\'3c\')(B,$(a,N));C B},bA:E(a,b){a=$(a,N);C B.6W(a).3T(a,b)},3T:E(a,b){I.3S.Y(b||\'3c\')($(a,N),B);C B},bB:E(a,b){C B.3T(B.4A().6Q(a),b)},8B:E(){1g.3J(M).14(E(a){a=$(a,N);G(a)B.3I(a)},B);C B},3d:E(){C(B.1C)?B.1C.80(B):B},6X:E(a,b){1J($V(B)){R\'1y\':F c={};J(F j=0,l=B.2y.P;j<l;j++){F d=B.2y[j],1p=d.6t.22();G(Q.15.1z&&(/8C/i).1K(B.2S)&&(/2k|2V/).1K(1p))2c;F e=(1p==\'1E\'&&B.1E)?B.1E.5O:d.6u;G(!$2v(e)||1p==\'1A\'||(1p==\'1M\'&&!b))2c;G(e!=\'bC\'&&[\'1G\',\'4l\'].1B($V(e)))c[1p]=e}F f=K I(B.6t.22(),c);G(a!==O){J(F i=0,k=B.3U.P;i<k;i++){F g=I.6X(B.3U[i],N,b);G(g)f.3T(g)}}C f;R\'6v\':C 1d.6Q(B.6u)}C T},6W:E(a){a=$(a,N);a.1C.8D(B,a);C B},6Y:E(a){C B.3e.1B(a,\' \')},8E:E(a){G(!B.6Y(a))B.3e=(B.3e+\' \'+a).5j();C B},8F:E(a){B.3e=B.3e.1u(K 4i(\'(^|\\\\s)\'+a+\'(?:\\\\s|$)\'),\'$1\').5j();C B},bD:E(a){C B.6Y(a)?B.8F(a):B.8E(a)},5P:E(a){G(B.4C)C B.4C[a.5q()];F b=B.2j().5P(B,T);C(b)?b.bE([a.89()]):T},1x:E(){$A(B.3U).14(E(a){Q.5E(a);I.1x(a);I.3d(a)},B);C B},bF:E(){Q.5E(B.1x().3d());C T},8G:E(){C K 2r($A(B.L).1V(E(a){C a.8H}))},3t:E(){F d=[];B.3w(\'8C, 6Z, bG\').14(E(b){G(!b.1a||b.8I)C;F c=(b.2S.22()==\'6Z\')?I.8G(b).2p(E(a){C a.1Z}):((b.V==\'bH\'||b.V==\'bI\')&&!b.5D)?T:b.1Z;$2P(c).14(E(a){G(a)d.1n(b.1a+\'=\'+6H(a))})});C d.3o(\'&\')},5L:E(a){F b=I.4D,1p=b.4E[a];F c=(1p)?B[1p]:B.bJ(a,2);C(b.3V[a])?!!c:(1p)?c:c||T},bK:E(){F b=$A(M);C b.2p(E(a){C B.5L(a)},B).5k(b)},6V:E(a,b){F c=I.4D,1p=c.4E[a],4s=$33(b);G(1p&&c.3V[a])b=(b||!4s)?N:O;1j G(!4s)C B.5M(a);(1p)?B[1p]=b:B.7Z(a,b);C B},bL:E(a){J(F b 12 a)B.6V(b,a[b]);C B},5M:E(a){F b=I.4D,1p=b.4E[a],8J=(1p&&b.3V[a]);(1p)?B[1p]=(8J)?O:\'\':B.bM(a);C B},bN:E(){1g.14(M,B.5M,B);C B}});(E(){F i=E(a,b,c,d,e,f){F g=a[c||b];F h=[];1L(g){G(g.2w==1&&(!d||I.1r(g,d))){h.1n(g);G(!e)1l}g=g[b]}C(e)?K 2r(h,{3Q:O,3v:!f}):$(h[0],f)};I.1b({bO:E(a,b){C i(B,\'3W\',T,a,O,b)},bP:E(a,b){C i(B,\'3W\',T,a,N,b)},bQ:E(a,b){C i(B,\'2T\',T,a,O,b)},bR:E(a,b){C i(B,\'2T\',T,a,N,b)},bS:E(a,b){C i(B,\'2T\',\'5J\',a,O,b)},85:E(a,b){C i(B,\'3W\',\'bT\',a,O,b)},bU:E(a,b){C i(B,\'1C\',T,a,O,b)},bV:E(a,b){C i(B,\'1C\',T,a,N,b)},bW:E(a,b){C i(B,\'2T\',\'5J\',a,N,b)},8K:E(a){a=$(a,N);C(!!a&&$A(B.35(a.2S)).1B(a))}})})();I.1Y=K W;I.1Y.1E={1c:E(a){B.1E.5O=a},Y:E(){C B.1E.5O},36:E(){B.1E.5O=\'\'}};I.1Y.5N={Y:E(){C B.2S.22()}};I.1Y.5Q={Y:E(){C(!B.5Q)?T:B.5Q.1u(K 4i(\'^\'+1d.5G.bX+\'\\/\\/\'+1d.5G.6R),\'\')}};I.1Y.26={1c:E(){C B.8L=1g.3J(M).3o(\'\')}};1i.1b([I,2f,1U],{5H:E(a,b){G(B.8M)B.8M(a,b,O);1j B.bY(\'5C\'+a,b);C B},70:E(a,b){G(B.8N)B.8N(a,b,O);1j B.bZ(\'5C\'+a,b);C B},1m:E(a,b){F c=I.5I.Y(B.1A);F d=c[a];G($33(b)&&!$33(d))d=c[a]=b;C $5a(d)},2z:E(a,b){F c=I.5I.Y(B.1A);c[a]=b;C B},3X:E(a){F b=I.5I.Y(B.1A);1R b[a];C B}});I.4D=K W({4E:{\'26\':\'8L\',\'8p\':\'3e\',\'J\':\'c0\',\'2G\':(Q.15.1z)?\'71\':\'72\'},3V:[\'c1\',\'c2\',\'c3\',\'c4\',\'c5\',\'5D\',\'8I\',\'c6\',\'c7\',\'8H\',\'c8\',\'c9\'],73:[\'1Z\',\'ca\',\'cb\',\'cc\',\'cd\',\'ce\',\'cf\',\'cg\',\'ch\',\'ci\',\'cj\']});Q.5E=E(a){G(!a)C;G(Q.15.1z&&(/1H/i).1K(a.2S)){J(F p 12 a){G(1T a[p]==\'E\')a[p]=$1x}I.3d(a)}G(a.1A&&a.4x)a.4x()};(E(a){F b=a.3V,74=a.73;a.3V=b=b.5k(b);W.1k(W.6B(a.4E,b),74.5k(74.2p(E(v){C v.22()})));a.36(\'73\')})(I.4D);1o.5H(\'75\',E(){1o.70(\'75\',M.2m);1d.8w();G(Q.15.1z)ck()});I.1Y.1D={1c:E(a){B.6P(a)}};1i.1b([I,2f,1U],{2R:E(b,c){F d=B.1m(\'1D\',{});d[b]=d[b]||{\'2W\':[],\'76\':[]};G(d[b].2W.1B(c))C B;d[b].2W.1n(c);F e=b,3x=I.2x.Y(b),3y=c,5R=B;G(3x){G(3x.77)3x.77.1f(B,c);G(3x.3y){3y=E(a){G(3x.3y.1f(B,a))C c.1f(B,a);C O}}e=3x.4F||e}F f=E(){C c.1f(5R)};F g=I.78[e]||0;G(g){G(g==2){f=E(a){a=K 3M(a,5R.2j());G(3y.1f(5R,a)===O)a.8o()}}B.5H(e,f)}d[b].76.1n(f);C B},5B:E(a,b){F c=B.1m(\'1D\');G(!c||!c[a])C B;F d=c[a].2W.31(b);G(d==-1)C B;F e=c[a].2W.54(d,1)[0];F f=c[a].76.54(d,1)[0];F g=I.2x.Y(a);G(g){G(g.8O)g.8O.1f(B,b);a=g.4F||a}C(I.78[a])?B.70(a,f):B},6P:E(a){J(F b 12 a)B.2R(b,a[b]);C B},4x:E(a){F b=B.1m(\'1D\');G(!b)C B;G(!a){J(F c 12 b)B.4x(c);b=T}1j G(b[a]){1L(b[a].2W[0])B.5B(a,b[a].2W[0]);b[a]=T}C B},1W:E(b,c,d){F e=B.1m(\'1D\');G(!e||!e[b])C B;e[b].2W.14(E(a){a.2I({\'1O\':B,\'3a\':d,\'M\':c})()},B);C B},8P:E(b,c){b=$(b);F d=b.1m(\'1D\');G(!d)C B;G(!c){J(F e 12 d)B.8P(b,e)}1j G(d[c]){d[c].2W.14(E(a){B.2R(c,a)},B)}C B}});I.78={8g:2,cl:2,cm:2,cn:2,co:2,5t:2,6K:2,6L:2,6M:2,cp:2,cq:2,cr:2,8f:2,cs:2,ct:2,cu:2,cv:2,cw:2,cx:2,6Z:2,cy:2,1X:1,75:1,cz:2,cA:1,cB:1,8Q:1,cC:1,cD:1,8R:1,5S:1};(E(){F c=E(a){F b=a.5u;G(b==2b)C N;G(b===O)C O;C($V(B)!=\'1d\'&&b!=B&&b.cE!=\'cF\'&&!B.8K(b))};I.2x=K W({cG:{4F:\'6L\',3y:c},cH:{4F:\'6M\',3y:c},5t:{4F:(Q.15.4m)?\'6K\':\'5t\'}})})();I.1Y.cI={1c:E(a){B.79(a)}};I.1Y.28={1c:E(a,b){G(!b){G(a==0){G(B.1E.5T!=\'8S\')B.1E.5T=\'8S\'}1j{G(B.1E.5T!=\'7a\')B.1E.5T=\'7a\'}}G(!B.4C||!B.4C.8T)B.1E.8U=1;G(Q.15.1z)B.1E.1V=(a==1)?\'\':\'cJ(28=\'+a*cK+\')\';B.1E.28=a;B.2z(\'28\',a)},Y:E(){C B.1m(\'28\',1)}};I.1b({cL:E(a){C B.1c(\'28\',a,N)},cM:E(){C B.Y(\'28\')},5U:E(b,c){1J(b){R\'28\':C B.1c(\'28\',5o(c));R\'8V\':b=(Q.15.1z)?\'8W\':\'8X\'}b=b.5q();G($V(c)!=\'1G\'){F d=(I.5V.Y(b)||\'@\').3p(\' \');c=$2P(c).2p(E(a,i){G(!d[i])C\'\';C($V(a)==\'4l\')?d[i].1u(\'@\',1h.3K(a)):a}).3o(\' \')}1j G(c==1I(2E(c))){c=1h.3K(c)}B.1E[b]=c;C B},3z:E(b){1J(b){R\'28\':C B.Y(\'28\');R\'8V\':b=(Q.15.1z)?\'8W\':\'8X\'}b=b.5q();F c=B.1E[b];G(!$2v(c)){c=[];J(F d 12 I.4G){G(b!=d)2c;J(F s 12 I.4G[d])c.1n(B.3z(s));C c.3o(\' \')}c=B.5P(b)}G(c){c=1I(c);F e=c.1r(/cN?\\([\\d\\s,]+\\)/);G(e)c=c.1u(e[0],e[0].4q())}G(Q.15.5d||(Q.15.1z&&!$2v(3r(c)))){G(b.1K(/^(2V|2k)$/)){F f=(b==\'2k\')?[\'2J\',\'4v\']:[\'2U\',\'3c\'],3Y=0;f.14(E(a){3Y+=B.3z(\'2X-\'+a+\'-2k\').3s()+B.3z(\'4H-\'+a).3s()},B);C B[\'cO\'+b.3L()]-3Y+\'17\'}G(Q.15.5d&&1I(c).1K(\'17\'))C c;G(b.1K(/(2X(.+)8Y|3Z|4H)/))C\'cP\'}C c},79:E(a){J(F b 12 a)B.5U(b,a[b]);C B},cQ:E(){F b={};1g.14(M,E(a){b[a]=B.3z(a)},B);C b}});I.5V=K W({2J:\'@17\',2U:\'@17\',3c:\'@17\',4v:\'@17\',2k:\'@17\',2V:\'@17\',cR:\'@17\',cS:\'@17\',cT:\'@17\',cU:\'@17\',cV:\'2h(@, @, @)\',cW:\'@17 @17\',5W:\'2h(@, @, @)\',cX:\'@17\',cY:\'@17\',cZ:\'@17\',d0:\'d1(@17 @17 @17 @17)\',3Z:\'@17 @17 @17 @17\',4H:\'@17 @17 @17 @17\',2X:\'@17 @ 2h(@, @, @) @17 @ 2h(@, @, @) @17 @ 2h(@, @, @)\',7b:\'@17 @17 @17 @17\',7c:\'@ @ @ @\',7d:\'2h(@, @, @) 2h(@, @, @) 2h(@, @, @) 2h(@, @, @)\',d2:\'@\',\'8U\':\'@\',d3:\'@\',d4:\'@17\',28:\'@\'});I.4G={3Z:{},4H:{},2X:{},7b:{},7c:{},7d:{}};[\'d5\',\'d6\',\'d7\',\'d8\'].14(E(c){F d=I.4G;F e=I.5V;[\'3Z\',\'4H\'].14(E(a){F b=a+c;d[a][b]=e[b]=\'@17\'});F f=\'2X\'+c;d.2X[f]=e[f]=\'@17 @ 2h(@, @, @)\';F g=f+\'8Y\',5X=f+\'d9\',5Y=f+\'8Z\';d[f]={};d.7b[g]=d[f][g]=e[g]=\'@17\';d.7c[5X]=d[f][5X]=e[5X]=\'@\';d.7d[5Y]=d[f][5Y]=e[5Y]=\'2h(@, @, @)\'});(E(){I.1b({90:E(x,y){G(2s(B)){B.2j().90(x,y)}1j{B.4t=x;B.4u=y}C B},3f:E(){G(2s(B))C B.2j().3f();C{x:B.da,y:B.db}},4I:E(){G(2s(B))C B.2j().4I();C{x:B.91,y:B.92}},4J:E(){G(2s(B))C B.2j().4J();C{x:B.4t,y:B.4u}},93:E(){F a=B,1F={x:0,y:0};1L(a&&!2s(a)){1F.x+=a.4t;1F.y+=a.4u;a=a.1C}C 1F},dc:E(){F a=B;G(2s(a))C T;G(!Q.15.1z)C a.7e;1L((a=a.1C)&&!2s(a)){G(e(a,\'1F\')!=\'dd\')C a}C T},94:E(){F a=B,1F={x:0,y:0};G(2s(B))C 1F;1L(a&&!2s(a)){1F.x+=a.de;1F.y+=a.df;G(Q.15.4m){G(!7f(a)){1F.x+=4K(a);1F.y+=4L(a)}F b=a.1C;G(b&&e(b,\'dg\')!=\'7a\'){1F.x+=4K(b);1F.y+=4L(b)}}1j G(a!=B&&(Q.15.1z||Q.15.3G)){1F.x+=4K(a);1F.y+=4L(a)}a=a.7e;G(Q.15.1z){1L(a&&!a.4C.8T)a=a.7e}}G(Q.15.4m&&!7f(B)){1F.x-=4K(B);1F.y-=4L(B)}C 1F},41:E(a){G(2s(B))C{x:0,y:0};F b=B.94(),5S=B.93();F c={x:b.x-5S.x,y:b.y-5S.y};F d=(a&&(a=$(a)))?a.41():{x:0,y:0};C{x:c.x-d.x,y:c.y-d.y}},7g:E(a){G(2s(B))C B.2j().7g();F b=B.41(a),3Y=B.3f();F c={2J:b.x,2U:b.y,2k:3Y.x,2V:3Y.y};c.4v=c.2J+c.2k;c.3c=c.2U+c.2V;C c},95:E(a){C{2J:a.x-4M(B,\'3Z-2J\'),2U:a.y-4M(B,\'3Z-2U\')}},1F:E(a){C B.79(B.95(a))}});1i.1b([1U,2f],{3f:E(){F a=B.2j();G(Q.15.5d||Q.15.3G)C{x:a.dh,y:a.di};F b=5Z(B);C{x:b.dj,y:b.dk}},4J:E(){F a=B.2j();F b=5Z(B);C{x:a.8k||b.4t,y:a.8l||b.4u}},4I:E(){F a=5Z(B);F b=B.3f();C{x:1h.4o(a.91,b.x),y:1h.4o(a.92,b.y)}},41:E(){C{x:0,y:0}},7g:E(){F a=B.3f();C{2U:0,2J:0,3c:a.y,4v:a.x,2V:a.y,2k:a.x}}});F e=I.5P;E 4M(a,b){C e(a,b).3s()||0};E 7f(a){C e(a,\'-dl-96-dm\')==\'2X-96\'};E 4L(a){C 4M(a,\'2X-2U-2k\')};E 4K(a){C 4M(a,\'2X-2J-2k\')};E 2s(a){C(/^(?:3N|26)$/i).1K(a.2S)};E 5Z(a){F b=a.4A();C(!b.5s||b.5s==\'8h\')?b.26:b.3N}})();1i.1b([2f,1U,I],{dn:E(){C B.3f().y},do:E(){C B.3f().x},dp:E(){C B.4J().y},dq:E(){C B.4J().x},dr:E(){C B.4I().y},ds:E(){C B.4I().x},dt:E(){C B.41().y},du:E(){C B.41().x}});1i.1b([1U,I],{3w:E(a,b){a=a.3p(\',\');F c,97={};J(F i=0,l=a.P;i<l;i++){F d=a[i],2K=U.1S.3D(B,d,97);G(i!=0&&2K.34)2K=$A(2K);c=(i==0)?2K:(c.34)?$A(c).3n(2K):c.3n(2K)}C K 2r(c,{3Q:(a.P>1),3v:!b})}});I.1b({1r:E(a){G(!a)C N;F b=U.1S.7h(a);F c=b[0],1M=b[1];G(!U.2A.61(B,1M)||!U.2A.4N(B,c))C O;F d=U.1S.7i(a);C(d)?U.1S.1V(B,d,{}):N}});F U={2B:{3A:{},1w:{}}};U.42={1M:(/#([\\w-]+)/),5N:(/^(\\w+|\\*)/),98:(/^(\\w+|\\*)$/),99:(/\\s*([+>~\\s])\\s*([a-dv-Z#.*:\\[])/g),9b:(/\\.([\\w-]+)|\\[(\\w+)(?:([!*^$~|]?=)["\']?(.*?)["\']?)?\\]|:([\\w-]+)(?:\\(["\']?(.*?)?["\']?\\)|$)/g)};U.1S={2v:E(a,b){G(!b)C N;F c=$1A(a);G(!b[c])C b[c]=N;C O},9c:E(c){G(U.2B.3A[c])C U.2B.3A[c];F d=c.1r(/^([+-]?\\d*)?([a-z]+)?([+-]?\\d*)?$/);G(!d)C O;F e=3r(d[1]);F a=(e||e===0)?e:1;F f=d[2]||O;F b=3r(d[3])||0;G(a!=0){b--;1L(b<1)b+=a;1L(b>=a)b-=a}1j{a=b;f=\'4O\'}1J(f){R\'n\':d={a:a,b:b,2Y:\'n\'};1l;R\'9d\':d={a:2,b:0,2Y:\'n\'};1l;R\'9e\':d={a:2,b:1,2Y:\'n\'};1l;R\'9f\':d={a:0,2Y:\'4O\'};1l;R\'7j\':d={2Y:\'7j-3g\'};1l;R\'7k\':d={2Y:\'7k-3g\'};1l;3F:d={a:(a-1),2Y:\'4O\'}}C U.2B.3A[c]=d},7i:E(a){G(U.2B.1w[a])C U.2B.1w[a];F m,1w={3h:[],3i:[],2y:[]};1L((m=U.42.9b.4n(a))){F b=m[1],an=m[2],ao=m[3],av=m[4],62=m[5],7l=m[6];G(b){1w.3h.1n(b)}1j G(62){F c=U.43.Y(62);G(c)1w.3i.1n({3j:c,9g:7l});1j 1w.2y.1n({1a:62,7m:\'=\',1Z:7l})}1j G(an){1w.2y.1n({1a:an,7m:ao,1Z:av})}}G(!1w.3h.P)1R 1w.3h;G(!1w.2y.P)1R 1w.2y;G(!1w.3i.P)1R 1w.3i;G(!1w.3h&&!1w.2y&&!1w.3i)1w=T;C U.2B.1w[a]=1w},7h:E(a){F b=a.1r(U.42.5N);F c=a.1r(U.42.1M);C[(b)?b[1]:\'*\',(c)?c[1]:O]},1V:E(a,b,c){F i;G(b.3h){J(i=b.3h.P;i--;i){F d=b.3h[i];G(!U.2A.9h(a,d))C O}}G(b.2y){J(i=b.2y.P;i--;i){F e=b.2y[i];G(!U.2A.9i(a,e.1a,e.7m,e.1Z))C O}}G(b.3i){J(i=b.3i.P;i--;i){F f=b.3i[i];G(!U.2A.9j(a,f.3j,f.9g,c))C O}}C N},63:E(a,b,c){G(c){F d=(a.3R)?a.3R(c,N):I.3R(a,c,N);C(d&&U.2A.4N(d,b))?[d]:[]}1j{C a.35(b)}},3D:E(d,e,f){F g=[];F h=e.5p().1u(U.42.99,E(a,b,c){g.1n(b);C\':)\'+c}).3p(\':)\');F o,1r,64,34;J(F i=0,l=h.P;i<l;i++){F p=h[i];G(i==0&&U.42.98.1K(p)){o=d.35(p);2c}F q=g[i-1];F r=U.1S.7h(p);F s=r[0],1M=r[1];G(i==0){o=U.1S.63(d,s,1M)}1j{F t={},65=[];J(F j=0,k=o.P;j<k;j++)65=U.9k[q](65,o[j],s,1M,t);o=65}F u=U.1S.7i(p);G(u){64=[];J(F m=0,n=o.P;m<n;m++){34=o[m];G(U.1S.1V(34,u,f))64.1n(34)}o=64}}C o}};U.9k={\' \':E(a,b,c,d,e){F f=U.1S.63(b,c,d);J(F i=0,l=f.P;i<l;i++){F g=f[i];G(U.1S.2v(g,e))a.1n(g)}C a},\'>\':E(a,b,c,d,e){F f=U.1S.63(b,c,d);J(F i=0,l=f.P;i<l;i++){F g=f[i];G(g.1C==b&&U.1S.2v(g,e))a.1n(g)}C a},\'+\':E(a,b,c,d,e){1L((b=b.2T)){G(b.2w==1){G(U.1S.2v(b,e)&&U.2A.4N(b,c)&&U.2A.61(b,d))a.1n(b);1l}}C a},\'~\':E(a,b,c,d,e){1L((b=b.2T)){G(b.2w==1){G(!U.1S.2v(b,e))1l;G(U.2A.4N(b,c)&&U.2A.61(b,d))a.1n(b)}}C a}};U.2A={4N:E(a,b){C(b==\'*\'||(a.2S&&a.2S.22()==b))},61:E(a,b){C(!b||(a.1M&&a.1M==b))},9h:E(a,b){C(a.3e&&a.3e.1B(b,\' \'))},9j:E(a,b,c,d){C b.1f(a,c,d)},9i:E(a,b,c,d){F e=I.1t.5L.1f(a,b);G(!e)C O;G(!c||d==2b)C N;1J(c){R\'=\':C(e==d);R\'*=\':C(e.1B(d));R\'^=\':C(e.6o(0,d.P)==d);R\'$=\':C(e.6o(e.P-d.P)==d);R\'!=\':C(e!=d);R\'~=\':C e.1B(d,\' \');R\'|=\':C e.1B(d,\'-\')}C O}};U.43=K W({1x:E(){C!(B.71||B.72||\'\').P},dw:E(a){C!I.1r(B,a)},1B:E(a){C(B.71||B.72||\'\').1B(a)},\'9f-3g\':E(){C U.43.4O.1f(B,0)},\'7j-3g\':E(){F a=B;1L((a=a.2T)){G(a.2w==1)C O}C N},\'7k-3g\':E(){F a=B;1L((a=a.3W)){G(a.2w==1)C O}F b=B;1L((b=b.2T)){G(b.2w==1)C O}C N},\'3A-3g\':E(a,b){a=(a==2b)?\'n\':a;F c=U.1S.9c(a);G(c.2Y!=\'n\')C U.43[c.2Y].1f(B,c.a,b);F d=0;b.44=b.44||{};F e=$1A(B);G(!b.44[e]){F f=B;1L((f=f.3W)){G(f.2w!=1)2c;d++;F g=b.44[$1A(f)];G(g!=2b){d=g+d;1l}}b.44[e]=d}C(b.44[e]%c.a==c.b)},4O:E(a){F b=B,7n=0;1L((b=b.3W)){G(b.2w==1&&++7n>a)C O}C(7n==a)},9e:E(a,b){C U.43[\'3A-3g\'].1f(B,\'2n+1\',b)},9d:E(a,b){C U.43[\'3A-3g\'].1f(B,\'2n\',b)}});I.2x.7o={77:E(a){G(Q.66)a.1f(B)}};(E(){F a=E(){G(Q.66)C;Q.66=N;1o.1W(\'7o\');1d.1W(\'7o\')};1J(Q.15.1a){R\'3G\':(E(){([\'66\',\'45\'].1B(1d.9l))?a():M.2m.3a(50)})();1l;R\'1z\':F b=1d.5f(\'7p\');(E(){($2o(E(){b.dx(\'2J\');C $(b).5K(1d.3N).1c(\'26\',\'dy\').3d()}))?a():M.2m.3a(50)})();1l;3F:1o.2R(\'1X\',a);1d.2R(\'8Q\',a)}})();F 2L=K W({4P:E(d){1J($V(d)){R\'1G\':C\'"\'+d.1u(/[\\dz-\\dA\\\\"]/g,2L.$9m)+\'"\';R\'3E\':C\'[\'+1I(d.2p(2L.4P).1V($33))+\']\';R\'1H\':R\'58\':F e=[];W.14(d,E(a,b){F c=2L.4P(a);G(c)e.1n(2L.4P(b)+\':\'+c)});C\'{\'+e+\'}\';R\'4l\':R\'7N\':C 1I(d);R O:C\'T\'}C T},$9n:{\'\\b\':\'\\\\b\',\'\\t\':\'\\\\t\',\'\\n\':\'\\\\n\',\'\\f\':\'\\\\f\',\'\\r\':\'\\\\r\',\'"\':\'\\\\"\',\'\\\\\':\'\\\\\\\\\'},$9m:E(a){C 2L.$9n[a]||\'\\\\dB\'+1h.6s(a.6n()/16).55(16)+(a.6n()%16).55(16)},9o:E(a,b){G($V(a)!=\'1G\'||!a.P)C T;G(b&&!(/^[,:{}\\[\\]0-9.\\-+dC-u \\n\\r\\t]*$/).1K(a.1u(/\\\\./g,\'@\').1u(/"[^"\\\\\\n\\r]*"/g,\'\')))C T;C 6N(\'(\'+a+\')\')}});1i.1b([W,1g,1I,2E],{dD:E(){C 2L.4P(B)}});F 3k=K 1v({3O:4y,L:{67:O,4Q:O,2M:O,4R:O,1d:1d},1q:E(a,b){B.1p=a;B.4z(b)},68:E(a){a=6H(a);G(B.L.4Q)a+=\'; 4Q=\'+B.L.4Q;G(B.L.67)a+=\'; 67=\'+B.L.67;G(B.L.2M){F b=K 4j();b.dE(b.7R()+B.L.2M*24*60*60*7q);a+=\'; dF=\'+b.dG()}G(B.L.4R)a+=\'; 4R\';B.L.1d.9p=B.1p+\'=\'+a;C B},7r:E(){F a=B.L.1d.9p.1r(\'(?:^|;)\\\\s*\'+B.1p.8a()+\'=([^;]*)\');C(a)?dH(a[1]):T},3d:E(){K 3k(B.1p,$4k(B.L,{2M:-1})).68(\'\');C B}});3k.68=E(a,b,c){C K 3k(a,c).68(b)};3k.7r=E(a){C K 3k(a).7r()};3k.3d=E(a,b){C K 3k(a,b).3d()};F 3l=K 1v({3O:[4y],L:{1M:T,2V:1,2k:1,9q:T,5F:{},9r:{dI:\'dJ\',dK:\'dL\',dM:\'6C\',dN:N},4S:{},4T:{}},3u:E(){C B.1H},1q:E(b,c){B.4U=\'dO\'+$2d();B.4z(c);c=B.L;F d=B.1M=c.1M||B.4U;F e=$(c.9q);3l.69[B.4U]={};F f=c.9r,4T=c.4T,4S=c.4S;F g=$1k({2V:c.2V,2k:c.2k},c.5F);F h=B;J(F i 12 4S){3l.69[B.4U][i]=(E(a){C E(){C a.25(h.1H,M)}})(4S[i]);4T[i]=\'3l.69.\'+B.4U+\'.\'+i}f.dP=W.3t(4T);G(Q.15.1z){g.dQ=\'dR:dS-dT-dU-dV-dW\';f.dX=b}1j{g.V=\'6a/x-dY-dZ\';g.2C=b}F j=\'<1H 1M="\'+d+\'"\';J(F k 12 g)j+=\' \'+k+\'="\'+g[k]+\'"\';j+=\'>\';J(F l 12 f){G(f[l])j+=\'<e0 1a="\'+l+\'" 1Z="\'+f[l]+\'" />\'}j+=\'</1H>\';B.1H=((e)?e.1x():K I(\'7p\')).1c(\'26\',j).5J},6W:E(a){a=$(a,N);a.1C.8D(B.3u(),a);C B},5K:E(a){$(a,N).3I(B.3u());C B},7s:E(){C 3l.7s.25(3l,[B.3u()].1k(M))}});3l.69={};3l.7s=E(a,b){F c=a.e1(\'<9s 1a="\'+b+\'" e2="3H">\'+e3(M,2)+\'</9s>\');C 6N(c)};F 1e=K 1v({3O:[6O,2x,4y],L:{9t:50,7t:O,2M:9u,2g:\'9v\',6b:E(p){C-(1h.6E(1h.7u*p)-1)/2}},1q:E(a){B.3m=B.3m||B;B.4z(a);B.L.2M=1e.9w[B.L.2M]||B.L.2M.3s();F b=B.L.e4;G(b===O)B.L.2g=\'1P\'},9x:E(){F a=$2d();G(a<B.2d+B.L.2M){F b=B.L.6b((a-B.2d)/B.L.2M);B.1c(B.2l(B.47,B.2Z,b))}1j{B.1c(B.2l(B.47,B.2Z,1));B.45()}},1c:E(a){C a},2l:E(a,b,c){C 1e.2l(a,b,c)},48:E(a){G(!B.49)C N;1J(B.L.2g){R\'1P\':B.1P();C N;R\'2i\':B.2i(a.1O(B,1g.23(M,1)));C O}C O},2D:E(a,b){G(!B.48(M.2m,a,b))C B;B.47=a;B.2Z=b;B.2d=0;B.7v();B.9y();C B},45:E(){G(B.6c())B.9z();C B},1P:E(){G(B.6c())B.9A();C B},9y:E(){B.1W(\'2D\',B.3m)},9z:E(){B.1W(\'45\',B.3m);G(!B.5z())B.1W(\'e5\',B.3m)},9A:E(){B.1W(\'1P\',B.3m).8t()},e6:E(){B.6c();C B},e7:E(){B.7v();C B},6c:E(){G(!B.49)C O;B.2d=$2d()-B.2d;B.49=$7Q(B.49);C N},7v:E(){G(B.49)C O;B.2d=$2d()-B.2d;B.49=B.9x.4r(1h.3K(7q/B.L.9t),B);C N}});1e.2l=E(a,b,c){C(b-a)*c+a};1e.9w={\'e8\':e9,\'ea\':9u,\'eb\':7q};1e.2N=K 1v({3P:1e,7w:E(a,b,c){c=$2P(c);F d=c[1];G(!$2v(d)){c[1]=c[0];c[0]=a.3z(b)}F e=c.2p(B.3B);C{47:e[0],2Z:e[1]}},3B:E(f){f=$6p(f)();f=(1T f==\'1G\')?f.3p(\' \'):$2P(f);C f.2p(E(d){d=1I(d);F e=O;1e.2N.7x.14(E(a,b){G(e)C;F c=a.3B(d);G($2v(c))e={1Z:c,3j:a}});e=e||{1Z:d,3j:1e.2N.7x.1I};C e})},2l:E(a,b,c){F d=[];(1h.5l(a.P,b.P)).6D(E(i){d.1n({1Z:a[i].3j.2l(a[i].1Z,b[i].1Z,c),3j:a[i].3j})});d.$2u={1a:\'9B:9C:1Z\'};C d},4a:E(b,c){G($V(b)!=\'9B:9C:1Z\')b=B.3B(b);F d=[];b.14(E(a){d=d.3n(a.3j.4a(a.1Z,c))});C d},7y:E(a,b,c,d){a.5U(b,B.4a(c,d))},3D:E(h){G(1e.2N.2B[h])C 1e.2N.2B[h];F k={};1g.14(1d.ec,E(e,j){F f=e.5Q;G(f&&f.1B(\'://\')&&!f.1B(1d.4Q))C;F g=e.ed||e.ee;1g.14(g,E(c,i){G(!c.1E)C;F d=(c.9D)?c.9D.1u(/^\\w+/,E(m){C m.22()}):T;G(!d||!d.1K(\'^\'+h+\'$\'))C;I.5V.14(E(a,b){G(!c.1E[b]||I.4G[b])C;a=1I(c.1E[b]);k[b]=(a.1K(/^2h/))?a.4q():a})})});C 1e.2N.2B[h]=k}});1e.2N.2B={};1e.2N.7x=K W({8Z:{3B:E(a){G(a.1r(/^#[0-9a-f]{3,6}$/i))C a.5m(N);C((a=a.1r(/(\\d+),\\s*(\\d+),\\s*(\\d+)/)))?[a[1],a[2],a[3]]:O},2l:E(b,c,d){C b.2p(E(a,i){C 1h.3K(1e.2l(b[i],c[i],d))})},4a:E(a){C a.2p(2E)}},2E:{3B:5o,2l:1e.2l,4a:E(a,b){C(b)?a+b:a}},1I:{3B:$6p(O),2l:$M(1),4a:$M(0)}});1e.9E=K 1v({3P:1e.2N,1q:E(a,b){B.1y=B.3m=$(a);B.2Q(b)},1c:E(a,b){G(M.P==1){b=a;a=B.4V||B.L.4V}B.7y(B.1y,a,b,B.L.7t);C B},2D:E(a,b,c){G(!B.48(M.2m,a,b,c))C B;F d=1g.3J(M);B.4V=B.L.4V||d.4h();F e=B.7w(B.1y,B.4V,d);C B.2Q(e.47,e.2Z)}});I.1Y.29={1c:E(a){F b=B.1m(\'29\');G(b)b.1P();C B.3X(\'29\').2z(\'29:L\',$1k({2g:\'1P\'},a))},Y:E(a){G(a||!B.1m(\'29\')){G(a||!B.1m(\'29:L\'))B.1c(\'29\',a);B.2z(\'29\',K 1e.9E(B,B.1m(\'29:L\')))}C B.1m(\'29\')}};I.1b({29:E(a,b,c){B.Y(\'29\').2D(M);C B},6d:E(a){F b=B.Y(\'29\'),o=\'28\',4W;a=$5a(a,\'4W\');1J(a){R\'12\':b.2D(o,1);1l;R\'8n\':b.2D(o,0);1l;R\'ef\':b.1c(o,1);1l;R\'eg\':b.1c(o,0);1l;R\'4W\':F c=B.1m(\'6d:7z\',B.Y(\'28\')==1);b.2D(o,(c)?0:1);B.2z(\'6d:7z\',!c);4W=N;1l;3F:b.2D(o,M)}G(!4W)B.3X(\'6d:7z\');C B},7A:E(a,b){G(!b){b=B.1m(\'7A:9F\',B.3z(\'7B-5W\'));b=(b==\'6C\')?\'#eh\':b}F c=B.Y(\'29\');c.2D(\'7B-5W\',a||\'#ei\',b).2i(E(){B.5U(\'7B-5W\',B.1m(\'7A:9F\'));c.5z()}.1O(B));C B}});1e.9G=K 1v({3P:1e.2N,1q:E(a,b){B.1y=B.3m=$(a);B.2Q(b)},1c:E(a){G(1T a==\'1G\')a=B.3D(a);J(F p 12 a)B.7y(B.1y,p,a[p],B.L.7t);C B},2l:E(a,b,c){F d={};J(F p 12 a)d[p]=B.2Q(a[p],b[p],c);C d},2D:E(a){G(!B.48(M.2m,a))C B;G(1T a==\'1G\')a=B.3D(a);F b={},2Z={};J(F p 12 a){F c=B.7w(B.1y,p,a[p]);b[p]=c.47;2Z[p]=c.2Z}C B.2Q(b,2Z)}});I.1Y.2t={1c:E(a){F b=B.1m(\'2t\');G(b)b.1P();C B.3X(\'2t\').2z(\'2t:L\',$1k({2g:\'1P\'},a))},Y:E(a){G(a||!B.1m(\'2t\')){G(a||!B.1m(\'2t:L\'))B.1c(\'2t\',a);B.2z(\'2t\',K 1e.9G(B,B.1m(\'2t:L\')))}C B.1m(\'2t\')}};I.1b({2t:E(a){B.Y(\'2t\').2D(a);C B}});(E(){F d=1e.1t.1q;1e.1t.1q=E(a){d.1f(B,a);F b=B.L.6b;G(1T b==\'1G\'&&(b=b.3p(\':\'))){F c=1e.4b;c=c[b[0]]||c[b[0].3L()];G(b[1])c=c[\'ej\'+b[1].3L()+(b[2]?b[2].3L():\'\')];B.L.6b=c}}})();1e.7C=E(b,c){c=$2P(c);C $1k(b,{ek:E(a){C b(a,c)},el:E(a){C 1-b(1-a,c)},em:E(a){C(a<=0.5)?b(2*a,c)/2:(2-b(2*(1-a),c))/2}})};1e.4b=K W({en:$M(0)});1e.4b.1k=E(a){J(F b 12 a)1e.4b[b]=K 1e.7C(a[b])};1e.4b.1k({eo:E(p,x){C 1h.3b(p,x[0]||6)},ep:E(p){C 1h.3b(2,8*(p-1))},eq:E(p){C 1-1h.6F(1h.88(p))},er:E(p){C 1-1h.6F((1-p)*1h.7u/2)},es:E(p,x){x=x[0]||1.et;C 1h.3b(p,2)*((x+1)*p-x)},eu:E(p){F c;J(F a=0,b=1;1;a+=b,b/=2){G(p>=(7-4*a)/11){c=-1h.3b((11-6*a-11*p)/4,2)+b*b;1l}}C c},ev:E(p,x){C 1h.3b(2,10*--p)*1h.6E(20*p*1h.7u*(x[0]||1)/3)}});[\'ew\',\'ex\',\'ey\',\'ez\'].14(E(a,i){1e.4b[a]=K 1e.7C(E(p){C 1h.3b(p,[i+2])})});F 2e=K 1v({3O:[6O,2x,4y],L:{2a:\'\',2C:\'\',3C:{\'X-eA-eB\':\'6z\',\'9H\':\'2G/3H, 2G/26, 6a/4c, 2G/4c, */*\'},6e:N,6f:O,21:\'4X\',2g:\'9v\',4d:T,9I:N,9J:N,7D:\'eC-8\',6g:O,9K:O},1q:E(a){B.1Q=K Q.2e();B.4z(a);B.L.4d=B.L.4d||B.4d;B.3C=K W(B.L.3C)},7E:E(){G(B.1Q.9l!=4||!B.4e)C;B.4e=O;B.4f=0;$2o(E(){B.4f=B.1Q.4f}.1O(B));G(B.L.4d.1f(B,B.4f)){B.1s={2G:B.1Q.eD,4c:B.1Q.eE};B.4Y(B.1s.2G,B.1s.4c)}1j{B.1s={2G:T,4c:T};B.7F()}B.1Q.7G=$1x},4d:E(){C((B.4f>=eF)&&(B.4f<eG))},9L:E(a){G(B.L.9K||(/(eH|eI)5g/).1K(B.9M(\'9N-V\')))C $4n(a);C a.6G(B.L.6g)},4Y:E(a,b){B.6h(B.9L(a),b)},6h:E(){B.1W(\'45\',M).1W(\'4Y\',M).5z()},7F:E(){B.9O()},9O:E(){B.1W(\'45\').1W(\'7F\',B.1Q)},eJ:E(a,b){B.3C.1c(a,b);C B},9M:E(a){C $2o(E(){C B.1Q.eK(a)}.1O(B))},48:E(a){G(!B.4e)C N;1J(B.L.2g){R\'1P\':B.1P();C N;R\'2i\':B.2i(a.1O(B,1g.23(M,1)));C O}C O},1N:E(c){G(!B.48(M.2m,c))C B;B.4e=N;F d=$V(c);G(d==\'1G\'||d==\'1y\')c={2C:c};F e=B.L;c=$1k({2C:e.2C,2a:e.2a,21:e.21},c);F f=c.2C,2a=c.2a,21=c.21;1J($V(f)){R\'1y\':f=$(f).3t();1l;R\'1H\':R\'58\':f=W.3t(f)}G(B.L.6f){F g=\'6f=\'+B.L.6f;f=(f)?g+\'&\'+f:g}G(B.L.9I&&[\'9P\',\'1R\'].1B(21)){F h=\'eL=\'+21;f=(f)?h+\'&\'+f:h;21=\'4X\'}G(B.L.9J&&21==\'4X\'){F i=(B.L.7D)?\'; eM=\'+B.L.7D:\'\';B.3C.1c(\'9N-V\',\'6a/x-eN-eO-eP\'+i)}G(f&&21==\'Y\'){2a=2a+(2a.1B(\'?\')?\'&\':\'?\')+f;f=T}B.1Q.eQ(21.57(),2a,B.L.6e);B.1Q.7G=B.7E.1O(B);B.3C.14(E(a,b){G(!$2o(E(){B.1Q.eR(b,a);C N}.1O(B)))B.1W(\'eS\',[b,a])},B);B.1W(\'eT\');B.1Q.1N(f);G(!B.L.6e)B.7E();C B},1P:E(){G(!B.4e)C B;B.4e=O;B.1Q.8R();B.1Q.7G=$1x;B.1Q=K Q.2e();B.1W(\'1P\');C B}});(E(){F c={};[\'Y\',\'4X\',\'9P\',\'1R\',\'eU\',\'eV\',\'eW\',\'eX\'].14(E(b){c[b]=E(){F a=1g.2g(M,{2a:1I.V,2C:$33});C B.1N($1k(a,{21:b.22()}))}});2e.1b(c)})();I.1Y.1N={1c:E(a){F b=B.1m(\'1N\');G(b)b.1P();C B.3X(\'1N\').2z(\'1N:L\',$1k({2C:B,2g:\'1P\',21:B.Y(\'21\')||\'4X\',2a:B.Y(\'eY\')},a))},Y:E(a){G(a||!B.1m(\'1N\')){G(a||!B.1m(\'1N:L\'))B.1c(\'1N\',a);B.2z(\'1N\',K 2e(B.1m(\'1N:L\')))}C B.1m(\'1N\')}};I.1b({1N:E(a){F b=B.Y(\'1N\');b.1N({2C:B,2a:a||b.L.2a});C B}});2e.9Q=K 1v({3P:2e,L:{6i:O,6g:N,1V:O},9R:E(c){F d=c.1r(/<3N[^>]*>([\\s\\S]*?)<\\/3N>/i);c=(d)?d[1]:c;F e=K I(\'7p\');C $2o(E(){F a=\'<7H>\'+c+\'</7H>\',4g;G(Q.15.1z){4g=K 5e(\'eZ.f0\');4g.6e=O;4g.f1(a)}1j{4g=K f2().f3(a,\'2G/4c\')}a=4g.35(\'7H\')[0];J(F i=0,k=a.3U.P;i<k;i++){F b=I.6X(a.3U[i],N,N);G(b)e.3T(b)}C e})||e.1c(\'26\',c)},4Y:E(b){F c=B.L,1s=B.1s;1s.26=b.6G(E(a){1s.3H=a});F d=B.9R(1s.26);1s.6j=d.3U;1s.2K=d.3w(\'*\');G(c.1V)1s.6j=1s.2K.1V(c.1V);G(c.6i)$(c.6i).1x().8B(1s.6j);G(c.6g)$4n(1s.3H);B.6h(1s.6j,1s.2K,1s.26,1s.3H)}});I.1Y.1X={1c:E(a){F b=B.1m(\'1X\');G(b)1N.1P();C B.3X(\'1X\').2z(\'1X:L\',$1k({2C:B,2g:\'1P\',6i:B,21:\'Y\'},a))},Y:E(a){G(a||!B.1m(\'1X\')){G(a||!B.1m(\'1X:L\'))B.1c(\'1X\',a);B.2z(\'1X\',K 2e.9Q(B.1m(\'1X:L\')))}C B.1m(\'1X\')}};I.1b({1X:E(){B.Y(\'1X\').1N(1g.2g(M,{2C:53.V,2a:1I.V}));C B}});2e.2L=K 1v({3P:2e,L:{4R:N},1q:E(a){B.2Q(a);B.3C.1k({\'9H\':\'6a/7I\',\'X-2e\':\'2L\'})},4Y:E(a){B.1s.7I=2L.9o(a,B.L.4R);B.6h(B.1s.7I,a)}});',62,934,'|||||||||||||||||||||||||||||||||||||this|return||function|var|if||Element|for|new|options|arguments|true|false|length|Browser|case||null|Selectors|type|Hash||get||||in||each|Engine||px|||name|implement|set|document|Fx|call|Array|Math|Native|else|extend|break|retrieve|push|window|key|initialize|match|response|prototype|replace|Class|parsed|empty|element|trident|uid|contains|parentNode|events|style|position|string|object|String|switch|test|while|id|send|bind|cancel|xhr|delete|Utils|typeof|Document|filter|fireEvent|load|Properties|value||method|toLowerCase|slice||apply|html||opacity|tween|url|undefined|continue|time|Request|Window|link|rgb|chain|getWindow|width|compute|callee||try|map|event|Elements|isBody|morph|family|chk|nodeType|Events|attributes|store|Filters|Cache|data|start|Number|hasOwnProperty|text|Prototype|create|left|elements|JSON|duration|CSS|version|splat|parent|addEvent|tagName|nextSibling|top|height|keys|border|special|to|alias|indexOf||defined|item|getElementsByTagName|erase||||delay|pow|bottom|dispose|className|getSize|child|classes|pseudos|parser|Cookie|Swiff|subject|concat|join|split|unlink|parseInt|toInt|toQueryString|toElement|cash|getElements|custom|condition|getStyle|nth|parse|headers|search|array|default|webkit|javascript|appendChild|flatten|round|capitalize|Event|body|Implements|Extends|ddup|getElementById|Inserters|grab|childNodes|Bools|previousSibling|eliminate|size|margin||getPosition|RegExps|Pseudo|positions|complete||from|check|timer|serve|Transitions|xml|isSuccess|running|status|doc|shift|RegExp|Date|merge|number|gecko|exec|max|include|rgbToHex|periodical|hasValue|scrollLeft|scrollTop|right|previous|removeEvents|Options|setOptions|getDocument|contentWindow|currentStyle|Attributes|Props|base|ShortStyles|padding|getScrollSize|getScroll|leftBorder|topBorder|styleNumber|byTag|index|encode|domain|secure|callBacks|vars|instance|property|toggle|post|success|afterImplement||legacy|constructor|Object|splice|toString|charAt|toUpperCase|hash|mp|pick|forEach|Platform|presto|ActiveXObject|createElement|script|head|iframe|clean|associate|min|hexToRgb|attempt|parseFloat|trim|camelCase|keyOf|compatMode|mousewheel|relatedTarget|stopPropagation|preventDefault|Mutators|_parent_|callChain|removeOn|removeEvent|on|checked|freeMem|properties|location|addListener|Storage|firstChild|inject|getProperty|removeProperty|tag|cssText|getComputedStyle|href|self|scroll|visibility|setStyle|Styles|color|bds|bdc|getCompatElement||byID|pn|getByTagAndID|filtered|found|loaded|path|write|CallBacks|application|transition|stopTimer|fade|async|format|evalScripts|onSuccess|update|tree|typize|genericize|Function|charCodeAt|substr|lambda|getClean|random|floor|nodeName|nodeValue|textnode|collection|navigator|Features|XMLHttpRequest|UID|combine|transparent|times|cos|sin|stripScripts|encodeURIComponent|pageX|pageY|DOMMouseScroll|mouseover|mouseout|eval|Chain|addEvents|newTextNode|host|returned|insertBefore|ownerDocument|setProperty|replaces|clone|hasClass|select|removeListener|innerText|textContent|Camels|EAC|unload|values|onAdd|NativeEvents|setStyles|visible|borderWidth|borderStyle|borderColor|offsetParent|borderBox|getCoordinates|parseTagAndID|parseSelector|last|only|pa|operator|count|domready|div|1000|read|remote|unit|PI|startTimer|prepare|Parsers|render|flag|highlight|background|Transition|encoding|onStateChange|failure|onreadystatechange|root|json|build|generics|protect|native|boolean|valueOf|lastIndexOf|clear|getTime|whitespace|xpath|Plugins|getElementsByClassName|Flash|ShockwaveFlash|execScript|setAttribute|removeChild|defaultView|parentWindow|every|some|getLast|run|toFloat|acos|hyphenate|escapeRegExp|extended|target|which|Keys|keydown|click|CSS1Compat|clientX|clientY|pageXOffset|pageYOffset|wheelDelta|out|stop|class|parentOf|ptype|caller|clearChain|internal|newElement|purge|Constructors|multi|IFrame|onload|adopt|input|replaceChild|addClass|removeClass|getSelected|selected|disabled|isBool|hasChild|innerHTML|addEventListener|removeEventListener|onRemove|cloneEvents|DOMContentLoaded|abort|hidden|hasLayout|zoom|float|styleFloat|cssFloat|Width|Color|scrollTo|scrollWidth|scrollHeight|getScrolls|getOffsets|computePosition|box|local|quick|splitter||combined|parseNthArgument|odd|even|first|argument|byClass|byAttribute|byPseudo|Getters|readyState|replaceChars|specialChars|decode|cookie|container|params|invoke|fps|500|ignore|Durations|step|onStart|onComplete|onCancel|fx|css|selectorText|Tween|original|Morph|Accept|emulation|urlEncoded|evalResponse|processScripts|getHeader|Content|onFailure|put|HTML|processHTML|MooTools|Boolean|pop|reverse|sort|unshift|substring|clearTimeout|clearInterval|now|catch|isFinite|getLength|unknown|platform|mac|win|linux|other|evaluate|air|runtime|opera|950|925|taintEnabled|420|419|getBoxObjectFor|orientation|ipod|||MSXML2|XMLHTTP|plugins|Shockwave|description|GetVariable||r0|DOMElement|trident4|execCommand|BackgroundImageCache|getRandom|setTimeout|setInterval|pass|bindWithEvent|limit|abs|asin|atan|atan2|ceil|exp|log|sqrt|tan|gi|substitute|has|getKeys|getValues|srcElement|keyCode|111|fromCharCode|mouse|menu|120|detail|button|over|fromElement|page|client|rightClick|wheel|code|shiftKey|control|ctrlKey|alt|altKey|meta|metaKey|enter|up|down|esc|space|backspace|tab|cancelBubble|returnValue|bthis|createTextNode|IFrame_|frames|embed|getElement|before|after|inside|wraps|appendText|inherit|toggleClass|getPropertyValue|destroy|textarea|radio|checkbox|getAttribute|getProperties|setProperties|removeAttribute|removeProperties|getPrevious|getAllPrevious|getNext|getAllNext|getFirst|lastChild|getParent|getParents|getChildren|protocol|attachEvent|detachEvent|htmlFor|compact|nowrap|ismap|declare|noshade|readonly|multiple|noresize|defer|accessKey|cellPadding|cellSpacing|colSpan|frameBorder|maxLength|readOnly|rowSpan|tabIndex|useMap|CollectGarbage|dblclick|mouseup|mousedown|contextmenu|mousemove|selectstart|selectend|keypress|keyup|focus|blur|change|reset|submit|beforeunload|resize|move|readystatechange|error|prefix|xul|mouseenter|mouseleave|styles|alpha|100|setOpacity|getOpacity|rgba|offset|0px|getStyles|maxWidth|maxHeight|minWidth|minHeight|backgroundColor|backgroundPosition|fontSize|letterSpacing|lineHeight|clip|rect|zIndex|fontWeight|textIndent|Top|Right|Bottom|Left|Style|offsetWidth|offsetHeight|getOffsetParent|static|offsetLeft|offsetTop|overflow|innerWidth|innerHeight|clientWidth|clientHeight|moz|sizing|getHeight|getWidth|getScrollTop|getScrollLeft|getScrollHeight|getScrollWidth|getTop|getLeft|zA|not|doScroll|temp|x00|x1f|u00|Eaeflnr|toJSON|setTime|expires|toGMTString|decodeURIComponent|quality|high|allowScriptAccess|always|wMode|swLiveConnect|Swiff_|flashVars|classid|clsid|D27CDB6E|AE6D|11cf|96B8|444553540000|movie|shockwave|flash|param|CallFunction|returntype|__flash__argumentsToXML|wait|chainComplete|pause|resume|short|250|normal|long|styleSheets|rules|cssRules|show|hide|fff|ffff88|ease|easeIn|easeOut|easeInOut|linear|Pow|Expo|Circ|Sine|Back|618|Bounce|Elastic|Quad|Cubic|Quart|Quint|Requested|With|utf|responseText|responseXML|200|300|ecma|java|setHeader|getResponseHeader|_method|charset|www|form|urlencoded|open|setRequestHeader|exception|request|GET|POST|PUT|DELETE|action|Microsoft|XMLDOM|loadXML|DOMParser|parseFromString'.split('|'),0,{}))

// Mediabox
var Mediabox;(function(){var g=0,options,images,activeImage,prevImage,nextImage,top,fx,preload,preloadPrev=new Image(),preloadNext=new Image(),overlay,center,image,bottomContainer,bottom,captionSplit,title,caption,prevLink,number,nextLink,URL,WH,WHL,mediaWidth,mediaHeight,mediaType="none",mediaSplit,mediaId="mediaBox";window.addEvent("domready",function(){$(document.body).adopt($$([overlay=new Element("div",{id:"mbOverlay"}).addEvent("click",close),center=new Element("div",{id:"mbCenter"}),bottomContainer=new Element("div",{id:"mbBottomContainer"})]).setStyle("display","none"));image=new Element("div",{id:"mbImage"}).injectInside(center);bottom=new Element("div",{id:"mbBottom"}).injectInside(bottomContainer).adopt(new Element("a",{id:"mbCloseLink",href:"#"}).addEvent("click",close),nextLink=new Element("a",{id:"mbNextLink",href:"#"}).addEvent("click",next),prevLink=new Element("a",{id:"mbPrevLink",href:"#"}).addEvent("click",previous),title=new Element("div",{id:"mbTitle"}),number=new Element("div",{id:"mbNumber"}),caption=new Element("div",{id:"mbCaption"}),new Element("div",{styles:{clear:"both"}}));fx={overlay:new Fx.Tween(overlay,{property:"opacity",duration:360}).set(0),image:new Fx.Tween(image,{property:"opacity",duration:360,onComplete:nextEffect}),bottom:new Fx.Tween(bottom,{property:"margin-top",duration:240})}});Mediabox={open:function(a,b,c){options=$extend({loop:false,overlayOpacity:0.8,resizeDuration:240,resizeTransition:false,initialWidth:320,initialHeight:180,showCaption:true,animateCaption:true,showCounter:true,counterText:'  ({x} of {y})',scriptaccess:'true',fullscreen:'true',fullscreenNum:'1',autoplay:'true',autoplayNum:'1',bgcolor:'#000000',
playerpath:'/slideshow/player.swf', // absolute path to player
																																																																																																																																																																																																																																																																																																																																																																																																								 backcolor:'000000',frontcolor:'999999',lightcolor:'000000',screencolor:'000000',controlbar:'over',controller:'true',flInfo:'true',revverID:'187866',revverFullscreen:'true',revverBack:'000000',revverFront:'ffffff',revverGrad:'000000',ytColor1:'000000',ytColor2:'333333',vmTitle:'1',vmByline:'1',vmPortrait:'1',vmColor:'ffffff'},c||{});if(typeof a=="string"){a=[[a,b,c]];b=0}if(/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){var d=new Number(RegExp.$1);if(d<3){options.overlayOpacity=1;overlay.className='mbOverlayFF'}}if(Browser.Engine.trident4){options.overlayOpacity=1;overlay.className='mbOverlayIE'}images=a;options.loop=options.loop&&(images.length>1);position();setup(true);top=window.getScrollTop()+(window.getHeight()/15);fx.resize=new Fx.Morph(center,$extend({duration:options.resizeDuration,onComplete:nextEffect},options.resizeTransition?{transition:options.resizeTransition}:{}));center.setStyles({top:top,width:options.initialWidth,height:options.initialHeight,marginLeft:-(options.initialWidth/2),display:""});fx.overlay.start(options.overlayOpacity);g=1;return changeImage(b)}};Element.implement({mediabox:function(a,b){$$(this).mediabox(a,b);return this}});Elements.implement({mediabox:function(b,c,d){c=c||function(a){return[a.href,a.title,a.rel]};d=d||function(){return true};var e=this;e.removeEvents("click").addEvent("click",function(){var a=e.filter(d,this);return Mediabox.open(a.map(c),a.indexOf(this),b)});return e}});function position(){overlay.setStyles({top:window.getScrollTop(),height:window.getHeight()})}function setup(c){["object",window.ie?"select":"embed"].forEach(function(b){Array.forEach(document.getElementsByTagName(b),function(a){if(c)a._mediabox=a.style.visibility;a.style.visibility=c?"hidden":a._mediabox})});overlay.style.display=c?"":"none";var d=c?"addEvent":"removeEvent";window[d]("scroll",position)[d]("resize",position);document[d]("keydown",keyDown)}function keyDown(a){switch(a.code){case 27:case 88:case 67:close();break;case 37:case 80:previous();break;case 39:case 78:next()}}function previous(){return changeImage(prevImage)}function next(){return changeImage(nextImage)}function changeImage(a){if((g==1)&&(a>=0)){g=2;image.set('html','');activeImage=a;prevImage=((activeImage||!options.loop)?activeImage:images.length)-1;nextImage=activeImage+1;if(nextImage==images.length)nextImage=options.loop?0:-1;$$(prevLink,nextLink,image,bottomContainer).setStyle("display","none");fx.bottom.cancel().set(0);fx.image.set(0);center.className="mbLoading";WH=images[a][2].match(/[0-9]+/g);if(WH){WHL=WH.length;mediaWidth=WH[WHL-2]+"px";mediaHeight=WH[WHL-1]+"px"}else{mediaWidth=options.initialWidth;mediaWidth=options.initialWidth}URL=images[a][0];captionSplit=images[activeImage][1].split('::');if(URL.match(/\.gif|\.jpg|\.png/i)){mediaType='img';preload=new Image();preload.onload=nextEffect;preload.src=images[a][0]}else if(URL.match(/\.flv|\.mp4/i)){mediaType='obj';preload=new Swiff(''+options.playerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay+'&controlbar='+options.controlbar,{id:'MediaboxSWF',width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/\.mp3|\.aac/i)){mediaType='obj';preload=new Swiff(''+options.playerpath+'?file='+URL+'&backcolor='+options.backcolor+'&frontcolor='+options.frontcolor+'&lightcolor='+options.lightcolor+'&screencolor='+options.screencolor+'&autostart='+options.autoplay,{id:'MediaboxSWF',width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/\.swf/i)){mediaType='obj';preload=new Swiff(URL,{id:'MediaboxSWF',width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/dailymotion\.com/i)){mediaType='obj';preload=new Swiff(URL,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/flickr\.com/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[5];preload=new Swiff('http://www.flickr.com/apps/video/stewart.swf',{id:mediaId,classid:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',width:mediaWidth,height:mediaHeight,params:{flashvars:'photo_id='+mediaId+'&amp;show_info_box='+options.flInfo,wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/google\.com\/videoplay/i)){mediaType='obj';mediaSplit=URL.split('=');mediaId=mediaSplit[1];preload=new Swiff('http://video.google.com/googleplayer.swf?docId='+mediaId+'&autoplay='+options.autoplayNum,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/metacafe\.com\/watch/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[4];preload=new Swiff('http://www.metacafe.com/fplayer/'+mediaId+'/.swf',{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/myspacetv\.com|vids\.myspace\.com/i)){mediaType='obj';mediaSplit=URL.split('=');mediaId=mediaSplit[2];preload=new Swiff('http://lads.myspace.com/videos/vplayer.swf?m='+mediaId+'&v=2&type=video',{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/revver\.com/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[4];preload=new Swiff('http://flash.revver.com/player/1.0/player.swf?mediaId='+mediaId+'&affiliateId='+options.revverID+'&allowFullScreen='+options.revverFullscreen+'&backColor=#'+options.revverBack+'&frontColor=#'+options.revverFront+'&gradColor=#'+options.revverGrad+'&shareUrl=revver',{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/seesmic\.com/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[5];preload=new Swiff('http://seesmic.com/Standalone.swf?video='+mediaId,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/youtube\.com/i)){mediaType='obj';mediaSplit=URL.split('=');mediaId=mediaSplit[1];preload=new Swiff('http://www.youtube.com/v/'+mediaId+'&autoplay='+options.autoplayNum+'&fs='+options.fullscreenNum+'&color1=0x'+options.ytColor1+'&color2=0x'+options.ytColor2,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/veoh\.com/i)){mediaType='obj';mediaSplit=URL.split('videos/');mediaId=mediaSplit[1];preload=new Swiff('http://www.veoh.com/videodetails2.swf?permalinkId='+mediaId+'&player=videodetailsembedded&videoAutoPlay='+options.AutoplayNum,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/viddler\.com/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[4];preload=new Swiff('http://www.viddler.com/player/e5398221/',{name:'viddler_'+mediaId+'_'+mediaSplit[6],id:mediaId,classid:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/vimeo\.com/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[3];preload=new Swiff('http://www.vimeo.com/moogaloop.swf?clip_id='+mediaId+'&amp;server=www.vimeo.com&amp;fullscreen='+options.fullscreenNum+'&amp;show_title='+options.vmTitle+'&amp;show_byline='+options.vmByline+'&amp;show_portrait='+options.vmPortrait+'&amp;color='+options.vmColor,{id:mediaId,width:mediaWidth,height:mediaHeight,params:{wmode:'opaque',bgcolor:options.bgcolor,allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/12seconds\.tv/i)){mediaType='obj';mediaSplit=URL.split('/');mediaId=mediaSplit[5];preload=new Swiff('http://embed.12seconds.tv/players/remotePlayer.swf',{id:mediaId,width:mediaWidth,height:mediaHeight,params:{flashvars:'vid='+mediaId+'',wmode:'opaque',bgcolor:'#ffffff',allowscriptaccess:options.scriptaccess,allowfullscreen:options.fullscreen}});nextEffect()}else if(URL.match(/\#mb_/i)){mediaType='inline';URLsplit=URL.split('#');preload=$(URLsplit[1]).get('html');nextEffect()}else{mediaType='url';mediaId="mediaId_"+new Date().getTime();preload=new Element('iframe',{'src':URL,'id':mediaId,'width':mediaWidth,'height':mediaHeight,'frameborder':0});nextEffect()}}return false}function nextEffect(){switch(g++){case 2:if(mediaType=="img"){mediaWidth=preload.width;mediaHeight=preload.height;image.setStyles({backgroundImage:"url("+URL+")",display:""})}else if(mediaType=="obj"){if(Browser.Plugins.Flash.version<8){image.setStyles({backgroundImage:"none",display:""});image.set('html','<div id="mbError"><b>Error</b><br/>Adobe Flash is either not installed or not up to date,<br/>please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" title="Get Flash" target="_new">Adobe.com</a> to download the free player.</div>')}else{image.setStyles({backgroundImage:"none",display:""});preload.inject(image)}}else if(mediaType=="inline"){image.setStyles({backgroundImage:"none",display:""});image.set('html',preload)}else if(mediaType=="url"){image.setStyles({backgroundImage:"none",display:""});preload.inject(image)}else{alert('this file type is not supported\n'+URL+'\nplease visit iaian7.com/webcode/Mediabox for more information')}$$(image,bottom).setStyle("width",mediaWidth);image.setStyle("height",mediaHeight);title.set('html',(options.showCaption&&(captionSplit.length>1))?captionSplit[0]:images[activeImage][1]);caption.set('html',(options.showCaption&&(captionSplit.length>1))?captionSplit[1]:"");number.set('html',(options.showCounter&&(images.length>1))?options.counterText.replace(/{x}/,activeImage+1).replace(/{y}/,images.length):"");if((prevImage>=0)&&(images[prevImage][0].match(/\.gif|\.jpg|\.png/i)))preloadPrev.src=images[prevImage][0];if((nextImage>=0)&&(images[nextImage][0].match(/\.gif|\.jpg|\.png/i)))preloadNext.src=images[nextImage][0];g++;case 3:center.className="";fx.resize.start({height:image.offsetHeight,width:image.offsetWidth,marginLeft:-image.offsetWidth/2});break;g++;case 4:bottomContainer.setStyles({top:top+center.clientHeight,marginLeft:center.style.marginLeft,visibility:"hidden",display:""});fx.image.start(1);break;case 5:if(prevImage>=0)prevLink.style.display="";if(nextImage>=0)nextLink.style.display="";if(options.animateCaption){fx.bottom.set(-bottom.offsetHeight).start(0)}bottomContainer.style.visibility="";g=1}}function close(){if(g){g=0;preload.onload=$empty;image.set('html','');for(var f in fx)fx[f].cancel();$$(center,bottomContainer).setStyle("display","none");fx.overlay.chain(setup).start(0)}return false}})();Mediabox.scanPage=function(){var d=$$("a").filter(function(a){return a.rel&&a.rel.test(/^lightbox/i)});$$(d).mediabox({},null,function(a){var b=this.rel.replace(/[[]|]/gi," ");var c=b.split(" ");return(this==a)||((this.rel.length>8)&&a.rel.match(c[1]))})};window.addEvent("domready",Mediabox.scanPage);