jQuery(document).ready(function($) {
    setTimeout('show_tb()',600);
});

function show_tb()
{
	tb_show('Warning', wpcw_wpurl + '/?wpcw=message&height=200&width=500&modal=true',false);
}

function wpdoor_remove()
{
	// remove THICK BOX
	tb_remove();
	
	// Send Ajax Request to LOG
	jQuery.get(wpcw_wpurl, { wpcw: "log" });
	/*,
	  function(data){
	    alert("Data Loaded: " + data);
	  }*/
}

function checkAge(f)
{
	if(checkAgeDrops(f)) wpdoor_remove();
	else alert("Du bist leider zu jung.");
}

function checkAgeDrops(f)
{
	var dob=new Date();
	var date=dob.getDate();
	var month=dob.getMonth()+ 1;
	var year=dob.getFullYear();
	
	var cmbmonth=parseInt(document.getElementById("cmbmonth").options[document.getElementById("cmbmonth").selectedIndex].value);
	var cmbday=parseInt(document.getElementById("cmbday").options[document.getElementById("cmbday").selectedIndex].value);
	var cmbyear=parseInt(document.getElementById("cmbyear").options[document.getElementById("cmbyear").selectedIndex].value);
	age=year-cmbyear;
	
	if(cmbmonth>month){age--;}
	else{if(cmbday>=date){age--;}}
	
	/*if(cmbmonth==0){alert("You must enter the month you were born in.");return false;}
	else if(cmbday==0){alert("You must enter the date you were born on.");return false;}
	else if(cmbyear==2003){alert("You must enter the year you were born in.");return false;}
	else*/ if(age<18){/*alert("You are too young, bye.");location.replace("http://www.w3.org/");*/return false;}
	/*else if(!document.getElementById("agree").checked){alert('Check the agree box to enter this site.');return false;}*/
	else{return true;}
}