function flash_size(height,open) {
    height+="px";
    $("#fastbook").css("height", height);
}

function setFormData(hotel, honap, nap, ev, ej, fo, childrens, iata, cluster, tracking){
      if (!document.forms['online_booking_form']){
        if (createFBform("online_booking_form","online_booking_form")) if(setData(hotel, honap, nap, ev, ej, fo, childrens, iata, cluster, tracking)) execForm();
      }else{
        if (setData(hotel, honap, nap, ev, ej, fo, childrens, iata, cluster, tracking)) execForm();
      }

}

function setData(hotel, honap, nap, ev, ej, fo, childrens, iata, cluster, tracking){
      //alert("children:"+childrens+"iata:"+iata+"cluster:"+cluster+"tr:"+tracking);
      document.forms['online_booking_form'].Hotelnames.value=hotel;
      if (cluster.length>0) document.forms['online_booking_form'].Clusternames.value=cluster;
      else document.forms['online_booking_form'].Clusternames.value=hotel;
      if (tracking.length>0) {
        document.forms['online_booking_form'].FSTBKNGTrackLink.value=tracking;
      }
      document.forms['online_booking_form'].frommonth.value=honap;
			document.forms['online_booking_form'].fromday.value=nap;
			document.forms['online_booking_form'].fromyear.value=ev;
			document.forms['online_booking_form'].nbdays.value=ej;  
			document.forms['online_booking_form'].adulteresa.value=fo;
      document.forms['online_booking_form'].enfantresa.value=childrens;
      if (iata.length>0) document.forms['online_booking_form'].AccessCode.value=iata;
			return true;
}

function execForm(){
		//alert("exec");
    hhotelDispoprice(document.forms['online_booking_form']); 
} 

//helper function to create the form
function createNewForm(name, id, action, method, target){
 if (name && id){
     var submitForm = document.createElement("FORM");
     document.body.appendChild(submitForm);
     submitForm.setAttribute('name',name);
     submitForm.setAttribute('id',id);
     if (method) submitForm.method = method;
     else submitForm.method = "POST";

     if (target) submitForm.target=target;
     else submitForm.target="dispoprice";
     if (action) submitForm.action=action;

     return submitForm;
  }else return false;
}

//helper function to add elements to the form
function createNewFormElement(inputForm, elementName, elementValue){
 var newElement = document.createElement("input");
  newElement.setAttribute('type', 'hidden'); 
  newElement.setAttribute('value', elementValue ); 
  newElement.setAttribute('name', elementName ); 
  newElement.setAttribute('id', elementName );
  inputForm.appendChild(newElement);
  newElement.value = elementValue;
 return newElement;
}

//function that creates the form, adds some elements
//and then submits it
function createFBform(name,id){
  var submitForm = createNewForm(name, id, "", "POST", "");
  createNewFormElement(submitForm, "showPromotions", 30);
  createNewFormElement(submitForm, "langue", "uk");
  createNewFormElement(submitForm, "Hotelnames", "all");
  createNewFormElement(submitForm, "Clusternames", "crshumellowmood");
  createNewFormElement(submitForm, "FSTBKNGTrackLink", "");
  createNewFormElement(submitForm, "CurrencyLabel", "EUR");
  
  createNewFormElement(submitForm, "frommonth", "");
  createNewFormElement(submitForm, "fromday", "");
  createNewFormElement(submitForm, "fromyear", "");
  createNewFormElement(submitForm, "nbdays", "1");
  createNewFormElement(submitForm, "adulteresa", "1");
  createNewFormElement(submitForm, "enfantresa", "0");
  createNewFormElement(submitForm, "AccessCode", "");
  /*var oScript = document.createElement("DIV");
  oScript.id=name+"_trdiv";
  oScript.innerHTML="<script type='text/javascript' src='http://ddaattaa.mellowmood.hu/fastbooking/fbfulltrack.js'></script>";
  oScript.style.display='none';
  submitForm.appendChild(oScript);*/
  
  /*var oScript = document.createElement("script");
  oScript.type= 'text/javascript';
  oScript.src = "http://ddaattaa.mellowmood.hu/fastbooking/fbfulltrack.js";
  submitForm.appendChild(oScript);*/
  return true;
}


/*
function setFormData(hotel, fmonth, fday, fyear, nights, adults,childrens,iata, tracklink,cluster,){
  document.forms['online_booking_form'].Hotelnames.value=hotel;
  document.forms['online_booking_form'].frommonth.value=fmonth;
  document.forms['online_booking_form'].fromday.value=fday;
  document.forms['online_booking_form'].fromyear.value=fyear;
  document.forms['online_booking_form'].nbdays.value=nights;  
  document.forms['online_booking_form'].adulteresa.value=adults;
  document.forms['online_booking_form'].enfantresa.value=childrens;
  document.forms['online_booking_form'].AccessCode.value=iata;
  execForm();
}

function execForm(){
    hhotelDispoprice(document.forms['online_booking_form']);
} */

/*function addgoal(tip){
    if (!document.getElementById('goalframe')){
      agi=document.createElement('iframe');
      agi.id="goalframe";
      document.body.appendChild(agi);
    }
    else agi=document.getElementById('goalframe');
    agi.style.display='none';
    atmp=location.href.split("/");
    agi.src="http://"+atmp[2]+"/plugins/"+tip+"_goal.php";
}*/