// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// Version check based upon the values entered above in "Globals"
var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

function hasGoodVersion() {
    return DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
}
//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function flash_visibility() {
	var flash_objects=document.getElementsByTagName("object");
	var i=0;
	for (i=0, m=flash_objects.length; i<m; i++) {
		if (flash_objects.item(i).className=='flash') {
			if (obj=document.getElementById(flash_objects.item(i).id+'_no_flash')) {
				obj.style.display='none';
			}
			flash_objects.item(i).style.display='inline';
		}
	}
	if (obj=document.getElementById('top')) {
		obj.style.vAlign='top';
	}
}

function flash_invisibility() {
	var flash_objects=document.getElementsByTagName("object");
	var i=0;
	for (i=0, m=flash_objects.length; i<m; i++) {
		if (flash_objects.item(i).className=='flash') {
			if (obj=document.getElementById(flash_objects.item(i).id+'_no_flash')) {
				obj.style.display='inline';
			}
			flash_objects.item(i).style.display='none';
		}
	}
	if (obj=document.getElementById('top')) {
		obj.style.vAlign='top';
	}
}

function open_popup(l,h,url) {
	hauteur=Math.round((screen.availHeight-h)/2);
	largeur=Math.round((screen.availWidth-l)/2);
	window.open(url, "site", "toolbar=0,location=0,directories=0,status=0, scrollbars=0,resizable=0,menubar=0,top="+hauteur+",left="+largeur+",width="+l+",height="+h);
}

// -----------------------------------------------------------------------------
function returnRoomsDataArray(rooms_element) {
	var result = new Array();
	var i=0;
	for (i=0, m=rooms_element.childNodes.length; i<m; i++) {
		if (rooms_element.childNodes.item(i)== '[object HTMLDivElement]' ) {
			alert(rooms_element.childNodes.item(i));
			var id = rooms_element.childNodes.item(i).id;
			var artopush = new Array(id);
			result.push(artopush);
		}
	}
	return true;
}
function meoverlayon() {
    //flash_invisibility();
	var obj2 = document.getElementById('overlay');
	obj2.style.display='block';
	
	var inputs=document.getElementsByTagName("input");
	
	var i=0;
	for (i=0, m=inputs.length; i<m; i++) {
	    inputs.item(i).disabled = true;
	}
	
	var selects=document.getElementsByTagName("select");
	
	for (i=0, m=selects.length; i<m; i++) {
	    selects.item(i).disabled = true;
	}
	
	//var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var obj3 = document.getElementById('inov');
	
	obj3.style.top=(arrayPageScroll[1]) +"px";
	
	return true;
}

function meoverlayoff() {
	//flash_visibility();
	var obj2 = document.getElementById('overlay');
	obj2.style.display='none';
	
	var inputs=document.getElementsByTagName("input");
	
	var i=0;
	for (i=0, m=inputs.length; i<m; i++) {
	    /*if (
	       (inputs.item(i).id != 'arrival_date_day') && 
	       (inputs.item(i).id != 'departure_date_day') &&
	       (inputs.item(i).id != 'outward_date_day') &&
	       (inputs.item(i).id != 'return_date_day')
	    ) {*/
	       inputs.item(i).disabled = false;
	    /*}*/
	}
	
	var selects=document.getElementsByTagName("select");
	
	for (i=0, m=selects.length; i<m; i++) {
	    selects.item(i).disabled = false;
	}
	
	
	return true;
}

/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function ismaxlength(obj){
    var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
    if (obj.getAttribute && obj.value.length>mlength)
    obj.value=obj.value.substring(0,mlength)
}

function setContactFormVisibility(id, visibility) {
    var obj = document.getElementById(id);
    obj.style.display=visibility;
}

