jQuery.fn.href = function() {
	datetypechunk = $(this).attr("href").split("#");
	return (datetypechunk[datetypechunk.length-1]);
};


function gettopost_all(){
	$("a[@href*='?']").click(function(){
		$("body").append("<form id='gettopost' method='post'></form>");
		var params = $(this).attr("phref").split("?");
		var allparams = params[1].split("&");
		for(f=0;f<allparams.length;f++){
			var bits = allparams[f].split("=");
			if(bits.length==2) $("#gettopost").prepend("<input type='hidden' name='"+bits[0]+"' value='"+bits[1]+"' />");	
		}
		$("#gettopost").attr("action",params[0])[0].submit();
		return false;
	}).each(function(i){$(this).attr("phref",this.href);this.href=location.href;});
}
function gettopost_link(){
	$("a[@link]").click(function(){
		$("body").append("<form id='gettopost' method='post'></form>");
		var allparams = $(this).attr("link").split("&");
		for(f=0;f<allparams.length;f++){
			var bits = allparams[f].split("=");
			if(bits.length==2) $("#gettopost").prepend("<input type='hidden' name='"+bits[0]+"' value='"+bits[1]+"' />");	
		}
		$("#gettopost").attr("action",$(this).attr("href"))[0].submit();
		return false;
	});
}

$(document).ready(function(){
	gettopost_link();
	$(".popup").click(function(){
		window.open($(this).href());
		return false;
	});
	
	$(".fullScreenPopup").click(function(){
		day = new Date();
		id = day.getTime();
		URL = $(this).href();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+screen.width+",height="+screen.height+"');");
		return false;
	});
});

function popUp(URL,width,height) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=760,height=600');");
	return false;
}
function popUpPoliceman(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+screen.width+",height="+screen.height+"');");
	return false;
}

