function myInit() {	
	
	
	/*
	if (window.location.hostname == 'www.amadeushotelit.com') {
		$("a[href^='http:']").not("[href*='www.amadeushotelit.com']").attr('target','_blank');
		}	
	if (window.location.hostname == 'www.amadeus.com') {
		$("a[href^='http:']").not("[href*='www.amadeus.com']").attr('target','_blank');
		}
	*/
	

	
	$('#navigation ul li:has(li.selected)').addClass('selected').css('background-color','#E8F0F9');
	
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
	// which column is tallest?
	maxheight = $(".leftColumn").height();
	if ($(".middleColumn").height() > maxheight) {
		maxheight = $(".middleColumn").height();
		}
	if ($(".rightColumn").height() > maxheight) {
		maxheight = $(".rightColumn").height();
		}
	$('#wrapper').height(maxheight+30);
	}
	
	if ($('#quoteContainer').html()) {
		$('#quoteContainer').show().cycle({
			fx: 'fade',
			timeout: 7000,
			cleartypeNoBg: true 
			});
		}
	
	$("#commentForm").submit(function() {		
		$('#commentForm').attr('method','post');
		errors = '';	
		if (!$('#cf_name').val()) {
			errors += "Name\n";
			}
		if (!$('#cf_email').val()) {
			errors += "Email\n";
			}
		if (!$('#cf_comment').val()) {
			errors += "Comment\n";
			}
		if (errors) {			
			alert("The following fields are required:\n\n"+errors);
			return false;
			} 	
		});
		
	$("#pollVoteForm").submit(function() {		
		
		var answer = $("input[name='poll']:checked").val();
		var errors = "";
		if (!answer) {
			alert("Please select from the available options");
			return false;
			}
		$.ajax({
			type: "POST",
			url: "/hotelit/poll.php",
			data: "answer="+answer,
			success: function(returned){					
				getPollResults();
				}
			});				
		return false;	
		
	   });	
	
	
	}


function getPollResults() {
	
	$.ajax({
		type: "POST",
		url: "/hotelit/poll.php",
		data: "",
		success: function(returned){					
			$('#pollVoteForm').fadeOut("fast", function() {
				$('#pollResults').html(returned).fadeIn("fast");
				});
			
			}
		});		
	}
	
function isEmail(strEmail) {
	if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}






function checkOtherCat(x){
  var el=document.getElementById('othercat');
  if (x=='Other'){
      el.style.display="";
    }else{
       el.style.display="none";
       el.value=""; 
        }
}


function checkincidentrelated(x){
  var el=document.getElementById('incidentrelatedtd');
  if (x=='Yes'){
      el.style.display="";
    }else{
       el.style.display="none";
        }
}

function checkEMail(src) {
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return regex.test(src);
 }


function validateFeedback(){
	frm=document.Managerfeedback;
	ok=1;

	el=document.getElementById("purpose");
	
	if (el.type == 'radio') {
	      var group = frm[el.name];
	      var checked = false;
	      if (!group.length)
	        checked = el.checked;
	      else
	        {
	        for (var r = 0; r < group.length; r++)
	          if ((checked = group[r].checked))
	            break;
	      if (!checked) {
	        alert("Please select a Purpose, this information is mandatory");
	        el.focus();
	        ok=0;
	        return false;
	      }
	      }
	}
	if (!checkEMail(frm.mail.value)){
	    alert("Please fill a valid mail, this information is mandatory");
	    frm.mail.focus();
	    return false;
	    ok=0;
	}
	if (frm.phone.value==""){
	    alert("Please fill the Telephone, this information is mandatory");
	    frm.phone.focus();
	    return false;
	    ok=0;
	}
	if (frm.Surname.value==""){
	    alert("Please fill your Surname, this information is mandatory");
	    frm.Surname.focus();
	    return false;
	    ok=0;
	}
	if (frm.Firstname.value==""){
	    alert("Please fill your Firt name, this information is mandatory");
	    frm.Firstname.focus();
	    return false;
	    ok=0;
	}
	if (frm.Company.value==""){
	    alert("Please fill Company name, this information is mandatory");
	    frm.Company.focus();
	    return false;
	    ok=0;
	}
	if (frm.Location.value==""){
	    alert("Please fill Location, this information is mandatory");
	    frm.Location.focus();
	    return false;
	    ok=0;
	}
	if (frm.Function.value==""){
	    alert("Please fill your Function in the company, this information is mandatory");
	    frm.Function.focus();
	    return false;
	    ok=0;
	}
	el=document.getElementById("category");
	catvalue="";
	if (el.type == 'radio') {
	      var group = frm[el.name];
	      var checked = false;
	      if (!group.length)
	        checked = el.checked;
	      else
	        {
	        for (var r = 0; r < group.length; r++)
	          if ((checked = group[r].checked)){
	            catvalue=group[r].value;
	            break;
	          }
	          
	      if (!checked) {
	        alert("Please select a Category, this information is mandatory");
	        el.focus();
	        ok=0;
	        return false;
	      }
	      }
	}
	if (catvalue=='Other'){
	          if (frm.othercat.value==""){
	              alert("Please specify Other Category, this information is mandatory");
	              frm.othercat.focus();
	              return false;
	              ok=0;
	          }
	}
	//still pending if other
	el=document.getElementById("incidentrelated");
	incidendentR="";
	if (el.type == 'radio') {
	      var group = frm[el.name];
	      var checked = false;
	      if (!group.length)
	        checked = el.checked;
	      else
	        {
	        for (var r = 0; r < group.length; r++)
	          if ((checked = group[r].checked)){
	            incidendentR=group[r].value;
	            break;
	          }
	          
	      if (!checked) {
	        alert("Please select if this is related to an incident, this information is mandatory");
	        el.focus();
	        ok=0;
	        return false;
	      }
	      }
	}
	if (incidendentR=='Yes'){
	          if (frm.incidentrelatednumber.value==""){
	              alert("Please specify the related case number, this information is mandatory");
	              frm.incidentrelatednumber.focus();
	              return false;
	              ok=0;
	          }
	}
	if (frm.Comment.value==""){
	    alert("Please fill your Comments, this information is mandatory");
	    frm.Function.focus();
	    return false;
	    ok=0;
	}
	if(ok=1){	
	    frm.submit();
	    return true;
	}else
	    {
	    return false;
	  }
}

