var _pop=null;
function wopen(url,w,h,c,win,op){
	var sw=screen.width;
	var sh=screen.height;
	var ops=op||"";
	var _W=w?w:sw;
	var _H=h?h:sh;
	var _l=(sw-_W)/2;
	var _t=(sh-_H)/2;
	var _n=win||"nwin";
	var _o="location=0,directory=0,status=0,titlebar=0,menubar=0,resizable=1,copyhistory=0";
	var _p=",width="+_W+",height="+_H+",";
	if(c) _p+="left="+_l+",top="+_t+",screenX="+_l+",screenY="+_t;
	if(_pop&&!_pop.closed) { _pop.close(); _pop=null;}
	if(!op||op==null||op=='') _pop=window.open('about:blank',_n,_o+_p);
	else _pop=window.open('about:blank',_n,ops+_p);
	_pop.location.href=url;
	if(_pop.focus()) _pop.focus();
}
$(document).ready(function(){
	$('.menubutton').mouseenter(function(){
		$('.topnavinfo').hide();
		$('#'+this.id+'info').show();
	});
	$('.menubutton').mouseleave(function(){
		$('.topnavinfo').hide();
	});	
	$("#topnavigation2 .active").trigger("load");	
    $("#langnav li").hover(
        function(){ $("ul", this).fadeIn("slow"); }, 
        function(){ } 
    );
    if (document.all) {
        $("#langnav li").hoverClass ("sfHover");
    };	
	if ( $("#f1").length > 0 ) {
		$('.faqlist li a').click(function(){
			var fid = this.id.substr(3);
			showFaq(fid);
		})
		$("#f1").show();
		activefaq=1;
	};
	if ( $("#prodinfo1").length > 0 ) {
		$('.prodlist li a').click(function(){
			var pid = this.id.substr(4);
			showProductinfo(pid);
			//alert('click prodinfo:'+pid);
		})
		$("#prodinfo1").show();
		activeprod=1;
	};
	$('#opendisclaimer').click(function(){
		wopen('/disclaimer.html',900,600,1,'terms','scrollbars=1');
	});
	$('#openterms').click(function(){
		wopen('/termsandconditions.html',900,600,1,'terms','scrollbars=1');
	});
});
$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};
function maximizeIframe(){
	
}
var activefaq=0;
function showFaq(fid){
	if(activefaq!=0){
		$('#f'+activefaq).hide();
	}
	$('#f'+fid).show();
	activefaq=fid;
}
var activeprod=0;
function showProductinfo(pid){
	if(activeprod!=0){
		$('#prodinfo'+activeprod).hide();
	}
	$('#prodinfo'+pid).show();
	activeprod=pid;
}
function checkSendSuggestion(){
	var f=document.suggestionform;
	var er="";
	if(!f.naam.value.length){er+="- Name missing\r\n"};
	if(!f.email.value.length){er+="- Email missing\r\n"};
	if(!f.comments.value.length){er+="- Comments missing\r\n"};
	if(er.length){
		alert(er);
	}else{
		//alert("submit suggestion");
		//f.submit();
		var dataString = 'language='+f.language.value+'&naam='+ f.naam.value + '&email=' + f.email.value + '&comments=' + f.comments.value;
		$.ajax({
	      type: "POST",
	      url: "/send-suggestions.php",
	      data: dataString,
	      success: function() {
	        $('#suggestionformbox').html("<div id='message'></div>");
	        $('#message').html("<h2>Suggestion Form Submitted!</h2>")
	        .append("<p>Thanks for your suggestion</p>")
	        .hide()
	        .fadeIn(1500);
	      }
	     });		
	}
}
function checkSendFaq(){
	var f=document.faqform;
	var er="";
	if(!f.naam.value.length){er+="- Name missing\r\n"};
	if(!f.email.value.length){er+="- Email missing\r\n"};
	if(!f.comments.value.length){er+="- Question missing\r\n"};
	if(er.length){
		alert(er);
	}else{
		//alert("submit faq");
		//f.submit();		
		var dataString = 'language='+f.language.value+'&naam='+ f.naam.value + '&email=' + f.email.value + '&comments=' + f.comments.value;
		$.ajax({
	      type: "POST",
	      url: "/send-faq.php",
	      data: dataString,
	      success: function() {
	        $('#faqformbox').html("<div id='message'></div>");
	        $('#message').html("<h2>Faq Form Submitted!</h2>")
	        .append("<p>Thanks for your question</p>")
	        .hide()
	        .fadeIn(1500);
	      }
	     });
		/**/		
	}	
}
function checkSendPromo(){
	var f=document.promoform;
	var er="";
	if(!f.naam.value.length){er+="- Name missing\r\n"};
	if(!f.email.value.length){er+="- Email missing\r\n"};
	if(!f.telephone.value.length){er+="- Telephone number missing\r\n"};
	if(er.length){
		alert(er);
	}else{
		//alert("submit faq");
		//f.submit();		
		var dataString = 'language='+f.language.value+'&naam='+ f.naam.value + '&email=' + f.email.value + '&telephone=' + f.telephone.value;
		$.ajax({
	      type: "POST",
	      url: "/send-promo.php",
	      data: dataString,
	      success: function() {
	        $('#promoformbox').html("<div id='message'></div>");
	        $('#message').html("<h2>Form Submitted!</h2>")
	        .append("<p>Thanks for participating. We'll keep you informed!</p>")
	        .hide()
	        .fadeIn(1500);
	      }
	     });
		/**/		
	}	
}
function setcountry(cid,lid){
	var f = document.landenform;
	f.countryid.value=cid;
	var loadurl = '/getproviders.php?cid='+cid+'&lid='+lid;
	//alert(loadurl);
	$('#colinner').load(loadurl);
}
