//live chat
$=jQuery;
$(document).ready(function(){
    $(document).bind("contextmenu",function(e){
        return false;
    });
	
	$("#pages li:has(ul)").addClass("hasChild");
						   
	$('.offline').hide();
	$('.online').hide();
	$("#slider").easySlider();
	$('#slickbox').hide();
	$('#slickboxlink').hide();
	$('#result').hide();
	$('#failure').hide();
	$('a#slick-toggle').click(function() {
		$('#slickboxlink').toggle('slow');
		return false;
	});
	$('a#slickbox-toggle').click(function() {
		$.ajax({
			url: '/wp-content/themes/opolo/ajax.php',
			type: 'POST',
			data: 'cmd=sendData',

			success: function(result) {
				//document.getElementById('googletalk').src="http://www.google.com/talk/service/badge/Start?tk=z01q6amlq7i14p1a70dm1vkvulg7t8e96lg89bci7b9fe5n8fnoo8uf5cphijjl2vk8m6pska1t5k6cbu6umfeuhng8s501pd6kgjgnsjmbv46u3q5jbvvq7i1insreqgrrnftk187l35j67i54rtrq6ve7et6fafe216gs08hk1lsa1eo286m7oc18cu14j3qk";
				$('#slickboxlink').toggle();
				//$('#slickbox').toggle('slow');
				//$('#online').toggle('slow');
				
				$.colorbox({
					href:'http://www.google.com/talk/service/badge/Start?tk=z01q6amlq7i14p1a70dm1vkvulg7t8e96lg89bci7b9fe5n8fnoo8uf5cphijjl2vk8m6pska1t5k6cbu6umfeuhng8s501pd6kgjgnsjmbv46u3q5jbvvq7i1insreqgrrnftk187l35j67i54rtrq6ve7et6fafe216gs08hk1lsa1eo286m7oc18cu14j3qk',
					iframe:true,
					title:'Hier geen reactie? Gebruik de "Bel me terug" functie en wij bellen u terug!',
					width:"80%",
					height:"80%"
				});
				
				//$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
			}
		});
		return false;
	});
	$('input#checkdomain').click(function() {
		$('#result').hide();
		$.ajax({
			url: '/wp-content/themes/opolo/ajax.php',
			type: 'POST',
			data: 'cmd=checkdomain&domain='+document.getElementById('domain').value,

			success: function(result) {
				document.getElementById('result').innerHTML=result,
				$('#result').show('slow');
			}
		});
		return false;
	});
	$('input#callme').click(function() {
		$('#failure').hide();
		$.ajax({
			url: '/wp-content/themes/opolo/ajax.php',
			type: 'POST',
			data: 'cmd=callme&naam='+document.getElementById('naam').value+'&telefoon='+document.getElementById('telefoon').value,

			success: function(result) {
				if(result!="failure") {
					document.getElementById('callmeresult').innerHTML=result;
				}else{
					document.getElementById('failure').innerHTML='U dient het formulier juist in te vullen.';
					$('#failure').show('slow');
				}
			}
		});
		return false;
	});
	$().ready(function() {
		$.ajax({
			url: '/wp-content/themes/opolo/ajax.php',
			type: 'POST',
			data: 'cmd=checkStatus',

			success: function(result) {
				if(result==0) {
					$('.offline').show('slow');
				}else{
					$('.online').show('slow');
				}
			}
		});
		return false;
	});
	
	$('#slideOut').hover(function(){
		$(this).animate({left:'0'},{queue:false,duration:400});
		//jQuery(this).animate({opacity:'1'});
	}, function() {
		$(this).animate({left:'-100px'},{queue:false,duration:400});
		//jQuery(this).animate({opacity:'0.7'});
	});
});
