/* Change Propieties de DW  */
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
}


/* mostra i amaga layer */
// http://bontragerconnection.com/ and http://www.willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
d.style.left = (cX+0) + "px";
d.style.top = (cY+5) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}


function redirectThirdCompany(args){
	var f =  document.createElement('form');
	var body = document.getElementsByTagName("body")[0];
	if(args.company == "clickair"){
		f.setAttribute('action','http://book.clickair.com/skylights/cgi-bin/skylights.cgi');
		}
		else{
			f.setAttribute('action','/booking/booking/selecciona-tu-vuelo');
		}
	f.setAttribute('method','post');
	//f.setAttribute('target','_blank');
	f.setAttribute('name','formThirdCompany');
	addInputField(f,'ADULT',args.adults);
	addInputField(f,'CHILD',args.children);
	addInputField(f,'INFANT',args.infants);
	addInputField(f,'language',args.language);
	addInputField(f,'depart1FlexBy','0101');
	addInputField(f,'fechas','0101');
	addInputField(f,'departDate1',args.departDate1);
	addInputField(f,'from1',args.from1);
	addInputField(f,'to1',args.to1);
	addInputField(f,'event','search');
	addInputField(f,'numberMarkets',args.travelType);
	addInputField(f,'page','SEARCH');
	addInputField(f,'page_to','SEARCH');
	addInputField(f,'travel',args.travelType);
	addInputField(f,'displayDate1',args.displayDate1);
	addInputField(f,'departDay1',args.departDate1.substr(6,8));
	addInputField(f,'departMonth1',args.departDate1.substr(0,6));



	if(args.travelType == "2"){
		addInputField(f,'from2',args.from2);
		addInputField(f,'to2',args.to2);
		addInputField(f,'departDate2',args.departDate2);	
		addInputField(f,'depart2FlexBy','0101');
		addInputField(f,'marca=','VYXGXG');
		addInputField(f,'displayDate2',args.displayDate2);
		addInputField(f,'departDay2',args.departDate2.substr(6,8));
		addInputField(f,'departMonth2',args.departDate2.substr(0,6));
	}else{
				addInputField(f,'marca=','VYXG');
	}
	body.appendChild(f);
	f.submit();
	
}
function addInputField(f,name,value){
	var theNewElem = document.createElement('input');  
	 theNewElem.setAttribute('name',name);  
    theNewElem.setAttribute('type','hidden');  
    theNewElem.setAttribute('value',value);
	f.appendChild(theNewElem);
}

