var toGo='';

function setPar(url) {
	toGo = url;
}

function goTo(e) {
	if (!e)
		e = window.event;

	if (console)
		console.log(window.event);

	if(e.target.tagName != 'a' && toGo)
		location.href = toGo;
}

function showSubMenu(rel) {
		rel=rel.replace(/cat/,'sub');

		$('#globsubnav > ul').addClass('subhide');

		$('#'+rel).removeClass('subhide');
	}


function search(val) {
	location.href="/search/"+val.toLowerCase()+"/";
	return false;
}


function storeAddress() {
	$('#response').html('Adding email address...');
	$.ajax({
		type: "GET",
		url: "/ajaxServer.php",
		data: "address="+escape($('#address').val()),
		success: function(msg){
			$("#response").html(msg);
		}
	});
	return false;
}



$(document).ready(function(){

	$("#pageflip").hover(function() {
		$("#pageflip img , .msg_block").stop()
			.animate({
				width: '307px',
				height: '319px'
			}, 500);
		} , function() {
		$("#pageflip img").stop()
			.animate({
				width: '50px',
				height: '52px'
			}, 220);
		$(".msg_block").stop()
			.animate({
				width: '50px',
				height: '50px'
			}, 200);
	});


});

function rand (min, max) {
    var argc = arguments.length;
    if (argc === 0) {
        min = 0;
        max = 2147483647;
    } else if (argc === 1) {
        throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
    }
    return Math.floor(Math.random() * (max - min + 1)) + min;

}

