/*
 * jsDbug JavaScript Library v.1
 * http://jsdbug.com/
 */

if ( location.href.indexOf("debug=true") != -1 ){
	var jqueryLocal = '';
	try{
		var jqueryIsLoaded=jQuery;
		jQueryIsLoaded=true;
	}catch(err){
		jqueryLocal = '\nUsing local version:\n';
		document.write('<script src="http://miqueo.com/js/jquery.js" type="text/javascript"></scr'+'ipt>');
	}
	var jsdbug = ' \
		<style> \
			body{margin-bottom:20px} \
			#jsdbug{ \
				font-family:helvetica,arial; \
				color: #505050; \
				font-size: 12px; \
				padding:5px; \
				text-align:center; \
				background:#ccc; \
				position:fixed; width:100%; left: 0; bottom:0; \
			} \
			#jsdbug a{ color:#999; text-decoration:none;} \
			#jsdbug a:hover{ color:#666;} \
		</style>';
	setTimeout("loadJsDebug();",1000);
}



function loadJsDebug(){
	//if ( $('body').height() < $(window).height() ){
	//	jsdbug += '<style>#jsdbug{position:fixed; width:100%; bottom:0;}</style>';
	//}
	//alert ('Running jsdbug');
	jsdbug += '<div id="jsdbug">jsdbug [ ';
	jsdbug += '<a href="javascript:void();" onclick="javascript:alert( jqueryLocal + \'jQuery version \' + jQuery.fn.jquery )">jQuery</a> | ';
	jsdbug += '<a href="javascript:void();" onclick="javascript:alert( navigator.userAgent )">User Agent</a>  | ';
	jsdbug += 'Cookies: ';
	jsdbug += '<a href="javascript:void();" onclick="javascript:alert( document.cookie )">Show</a> / ';
	jsdbug += '<a href="javascript:deleteAllCookies()">Clear</a> | ';
	jsdbug += '<a href="javascript:void()">Visitors</a> ';
		
	jsdbug += ']</div>';


		
	$(document).ready(function(){
		$('body').append( jsdbug );
		//$('#jsdbug').fadein();
	});
}



function deleteAllCookies() {
    var cookies = document.cookie.split(";");

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i];
        var eqPos = cookie.indexOf("=");
        var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
        document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
    }
}


