/* General javascript for general template */

// Start Floating Contact div / value= space between top and div
window.onscroll = function()
{
	if( window.XMLHttpRequest ) { // IE 6 doesn't implement position fixed nicely...
		if (document.documentElement.scrollTop > 160 || self.pageYOffset > 160) {
			document.getElementById('ourCompany-bg').style.position = 'fixed';
			document.getElementById('ourCompany-bg').style.top = '0';
		} else {
			document.getElementById('ourCompany-bg').style.position = 'absolute'; 
			document.getElementById('ourCompany-bg').style.top = 'auto';
		}
	}
}

// Small Buttons JS STARTS
var revert = new Array();
var inames = new Array('partybuttonfr', 'showbuttonfr', 'karaokebuttonfr', 'partybuttonnl', 'showbuttonen', 'partybuttonen');

// Preload STARTS
if (document.images) {
  var flipped = new Array();
  for(i=0; i< inames.length; i++) {
    flipped[i] = new Image();
    flipped[i].src = "images/"+inames[i]+"2.png";
  }
}
function over(num) {
  if(document.images) {
    revert[num] = document.images[inames[num]].src;
    document.images[inames[num]].src = flipped[num].src;
  }
}
function out(num) {
  if(document.images) document.images[inames[num]].src = revert[num];
}

// Hide/Show kits Starts
function showhide(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
		else {
			document.getElementById(shID+'-show').style.display = 'inline';
			document.getElementById(shID).style.display = 'none';
		}
	}
}

// Hide/Show kits for printing Starts
function showprint(shID) {
	if (document.getElementById(shID)) {
		if (document.getElementById(shID+'-show').style.display != 'none') {
			document.getElementById(shID+'-show').style.display = 'none';
			document.getElementById(shID).style.display = 'block';
		}
	}
}

// Start => contact form FR
// Email verification => contact form
function verification()
 {
 if(document.contact.name.value == "") {
  alert("Veuillez entrer votre nom svp !");
  document.contact.name.focus();
  return false;
 }
 if(document.contact.email.value == "") {
  alert("Veuillez entrer votre adresse email svp !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('@') == -1) {
  alert("Veuillez vérifier votre adresse email svp !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('.') == -1) {
  alert("Veuillez verifier votre adresse email svp !");
  document.contact.email.focus();
  return false;
 }
 if(document.contact.check.value !== "9") {
  alert("Veuillez entrer correctement le code de vérification !");
  document.contact.check.focus();
  return false;
 }
else
return true;
 }

// Start => contact form NL
// Email verification => contact form
function verificationnl()
 {
 if(document.contact.name.value == "") {
  alert("Gelieve uw naam in te voeren !");
  document.contact.name.focus();
  return false;
 }
 if(document.contact.email.value == "") {
  alert("Gelieve uw emailadres op te geven !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('@') == -1) {
  alert("Gelieve uw emailadres na te kijken !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('.') == -1) {
  alert("Gelieve uw emailadres na te kijken !");
  document.contact.email.focus();
  return false;
 } 
if(document.contact.check.value !== "9") {
  alert("Gelieve de verificatie code correct in te voeren !");
  document.contact.check.focus();
  return false;
 }
else
return true;
 }
 
// Start => contact form EN
// Email verification => contact form
function verificationen()
 {
 if(document.contact.name.value == "") {
  alert("Please enter your name !");
  document.contact.name.focus();
  return false;
 }
 if(document.contact.email.value == "") {
  alert("Please enter your email address !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('@') == -1) {
  alert("Please verify your email address !");
  document.contact.email.focus();
  return false;
 }
  else
 if(document.contact.email.value.indexOf('.') == -1) {
  alert("Please verify your email address !");
  document.contact.email.focus();
  return false;
 } 
if(document.contact.check.value !== "9") {
  alert("Please enter the correct verification code !");
  document.contact.check.focus();
  return false;
 }
else
return true;
 }
 
 // Date select => contact form FR
 var monthtext=['janv','févr','mars','avr','mai','juin','juil','août','sept','oct','nov','déc'];

function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=0; i<31; i++)
dayfield.options[i]=new Option(i, i)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtext[m], monthtext[m])
monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<11; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}

 // Date select => contact form NL
 var monthtextnl=['jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'];

function populatedropdownnl(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=0; i<31; i++)
dayfield.options[i]=new Option(i, i)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtextnl[m], monthtextnl[m])
monthfield.options[today.getMonth()]=new Option(monthtextnl[today.getMonth()], monthtextnl[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<11; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}

 // Date select => contact form EN
 var monthtexten=['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];

function populatedropdownen(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=0; i<31; i++)
dayfield.options[i]=new Option(i, i)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtexten[m], monthtexten[m])
monthfield.options[today.getMonth()]=new Option(monthtexten[today.getMonth()], monthtexten[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<11; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}
// End => contact form
