function show_location() {

	//workout aus map lightbox
    $('#au-facebox').css('left', (($('.background-1').width()/2) - ($('#au-facebox').width()/2)) + 'px');
    $('#faux_overlay').css('width', $('.background-1').width());
    $('#faux_overlay').css('height', $('.background-1').height());
    $('#au-facebox').fadeIn('slow');
    $('#faux_overlay').fadeIn('slow');
    
    $("#real_youtube").html('<img src="/wp-content/themes/oe/images/end/youtube_dummy.png" alt="Youtube"></img>');
}

function close_location() {
	$('#states-li-nt').css('display', 'none');
    $('#states-li-sa').css('display', 'none');
    $('#states-li-qld').css('display', 'none');
    $('#states-li-nsw').css('display', 'none');
    $('#states-li-wa').css('display', 'none');
    $('#states-li-vic').css('display', 'none');
    $('#states-li-act').css('display', 'none');
    $('#states-li-tas').css('display', 'none');
    
    $('#au-facebox').fadeOut('slow');
	$('#faux_overlay').fadeOut('slow');
	$('.ev_pop_container').fadeOut('slow');

	$("#real_youtube").html('<object width="315" height="202" wmode="transparent" id="ytplayer"><param name="movie" value="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param value="transparent" name="wmode"></param><embed src="http://www.youtube.com/v/oo4qEl8xgyI&hl=en_US&fs=1&rel=0&enablejsapi=1&playerapiid=ytplayer" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="315" height="202"></embed></object>');
    
}

function set_loc(c,s) {
	city = c;
	state = s;
	if (city != '') {
		document.getElementById('geo-loc').innerHTML = city+" ("+state+")";
	} else if (state == 'All') {
		document.getElementById('geo-loc').innerHTML = "Australia";
	} else if(state == '') {
		document.getElementById('geo-loc').innerHTML = "Australia";
		state = "All";
	} else {
		document.getElementById('geo-loc').innerHTML = state;
	}
		
}

function set_loc_c() {
	$json = {}
	if (city != ''){
		$json.city = city;
	}
	if (state != ''){
		$json.state = state;
	}
    $.post("/wp-content/themes/oe/ajax_setcookie.php", $json, function(){
    	reload_elist();
    });

    if (set_vis != 1) {
    	if (preloc == '') { //check if preloc is empty, insert dummy data to not screw format
    		preloc = "0,0,error,preloc_blank";
    	} else if (preloc == '0,0,e,d'){
    		preloc = "0,0,error,default_value";
    	} else if (preloc == '0,0,e,bad'){
    		preloc = "0,0,error,script_was_bad";
    	} else if (preloc == '0,0,e,not') {
    		preloc = "0,0,error,already_has_cookie";
    	}
    	
	    $json = {}
	    if (city!='') {
	    	$json.loc = preloc+","+city;
	    } else {
	    	$json.loc = preloc+","+state;
	    }
		
	    $.post("/wp-content/themes/oe/ajax_track_google_loc.php", $json);
    }
    
}

function reload_elist(){

	$json = {}
    if ($(".ev_pre_on").length == 1) {
        $json.d = "pre";
    }
    else if ($(".ev_mon2_on").length == 1) {
        $json.d = 2;
    }
    else if ($(".ev_tue3_on").length == 1) {
        $json.d = 3;
    }
    else if ($(".ev_wed4_on").length == 1) {
        $json.d = 4;    
    }
    else if ($(".ev_thu5_on").length == 1) {
        $json.d = 5
    }
    else if ($(".ev_fri6_on").length == 1) {
        $json.d = 6;
    }
    else if ($(".ev_sat7_on").length == 1) {
        $json.d = 7;
    }
    else if ($(".ev_sun8_on").length == 1) {
        $json.d = 8;    
    }
    else if ($(".ev_mon9_on").length == 1) {
        $json.d = 9;
    }
    else if ($(".ev_post_on").length == 1) {
        $json.d = "post";
    } else {
        $json.d = "all";
    }
    $("#ev_content").html("<div style=\"padding: 10px;\"><img src=\"/wp-content/themes/oe/images/ev_loader.gif\" /></div>");
    $.post("/wp-content/themes/oe/page_event_list_view.php", $json, function(html)
    {
    $("#ev_content").html(html);
    $jquery_site_wrapper("eventlistview");
    });
    
    if (city != '') {
		document.getElementById('loc-lb').innerHTML = city+", "+state;
	} else {
		document.getElementById('loc-lb').innerHTML = state;
	}
}

function set_visited_q() {
	if (set_vis != 1) {
		$(".btn-done").css('display','none');
		$("#aufbmap_q").html("Your current location is");
		$("#aufbmap_qm").html('');
		$("#aufbmap_qsub").css('visibility','visible');
		set_vis = 1;
	}
}