
/// DEFAULT JS SCRIPT

w33c = (document.getElementById)? true:false;
if (w33c) {
	nsb4 = false;
	ieb4 = false;
}
else if (!w33c) {
	nsb4 = (document.layers)? true:false;
	ieb4 = (document.all)? true:false;
}


if (w33c || ieb4 || nsb4) 	browserOK = true;

if (navigator.userAgent.indexOf("Firefox")!=-1)
	firefox = 1;
else
	firefox = 0;
	

	
function con(msg) {
	
	if(!msg)
		msg = "Let op: Weet u dit zeker ?";
        
	if(!confirm(msg))
		return false;
	
	return true;
}


function conPage(msg,page,target,param) {
	if(!msg)
		msg = "Weet u dit zeker ?";
		
    if(!confirm("Let op: "+msg))
		return false;
	
	loadPage(page,target,param)
}

function loadPage(page,target,param) {
	
	var url 	= domain+page;
	var pars 	= param;
	var target 	= target;

	if(jquery) {
		$.get(url+"&"+pars, "", function(data) {
	    	$("#"+target).html(data);
	    	
	  	});
	}
	
		
}

function sendForm(page, id, target){
	
	var page = domain+page;
	if(jquery) {
	    tmp = $('#'+id).serializeArray();
	    
	    $.post(page, tmp, function(data) {
	    	$("#"+target).html(data);
	  	});
		

	}

} 


if(jquery == 1) {

	function showOverlay() {
		
		$('body').append('<div id="overlay"></div>').css({ 'overflow' : 'hidden' } );	
		var arrPageSizes = ___getPageSize();
		$('#overlay').css({
			backgroundColor:	"#000",
			opacity:			"0.7",
			width:				arrPageSizes[0]+30,
			height:				arrPageSizes[1]
		}).fadeIn();

	}
	
	function hideOverlay() {
		$("#overlay").remove();
		$('body').css({ 'overflow' : 'auto' } );	
	}
	    

	function showCard() {
		
		showOverlay();
		$('#addShop').fadeIn("slow");
				
	}

	$(document).ready(function () {

		var arrPageSizes = ___getPageSize();
		
		//$("#page").css( { "min-height" : (arrPageSizes[1]-235)+"px" } );
		
		
		$(".fckLink").live("click", function() {
	    	rel = $(this).attr("rel");
	    	width = $("#content_"+rel).width();
	    	
	  
	    		
	    	loadPage("admin.php?page=content","content_"+rel,"textID="+rel+"&ajax=1"); 
	    });
	    
		/*$('body').delegate('a','click',function() {
			var a = new RegExp('/' + window.location.host + '/');
			if(!a.test(this.href)) {
				event.preventDefault();
				event.stopPropagation();
				window.open(this.href, '_blank');
			}
		});*/
	    
	    $(".tipTitle a ").click(function() {
		
			id = $(this).attr("rel");
				
			$(".tipInfo").each(function(){
				if ( $(this).hasClass("selected") ) {
					$(this).hide();
					$(this).removeClass("selected");
				}
				
			});
			
			$("#tip_"+id).slideDown(500);
			$("#tip_"+id).removeClass("selected");
			$("#tip_"+id).addClass("selected");
	
		});
	
	});
	
		
	function ___getPageSize() {
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}
		arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
		return arrayPageSize;
	};
	
	function ArrayToGet(array,suffix) {
		var pars;
		for( var i = 0, n = array.length;  i < n;  ++i ) {
	        el = array[i];
	        pars += "&"+suffix+"_"+i+"="+el;
	    }
	    
	    return pars;
	}

}

