var checkSkip = 0;
var checkCounter = 0;
var checkThreshold = 0;
var checkTimeout = 3250;
var sessionTypeId = 0;
var sessionId = 0;
var secret = 0;
var ipAddress = 0;

$(document).ready(function()
{
	// change section
	$("select[name='content_section']").change(function(){ changeContentSection(this.value); } );
	$("#showContentSectionStraight").click(function(){changeContentSection('straight'); return false;})
	$("#showContentSectionGay").click(function(){changeContentSection('gay'); return false;})
	
	$("#showExtraCategories").click(function(){
		$("#extraCategories").show(); 
		return false;
	});
	
	checkAccess();
	
	$("#showUserReport").click(function(){showUserReportWindow(); return false;});
});

function checkAccess()
{
	if($("input[name='check_access']").val() != "0")
	{
		var url = "http://"+ Math.round(Math.random()*10000) +".content.membersarea.nl/members/v3.0/check.js";
		$.getScript(url);
		setTimeout(function(){ checkAccess(); }, checkTimeout);
		return;
	}
	return;
}

function changeContentSection(contentSection)
{
	$.ajax({
		type: "GET",
		url: siteUrl +"api/setContentSection/"+ contentSection,
		success: function(result){
			if(result == "1")
			{
				 document.location.href = document.location.href;
			}
		}
	});

	return false;
}

function showUserReportWindow()
{
	var contentTypeId = $("#content_type_id").val();
	var contentId = $("#content_id").val();
	
	var url = siteUrl +"video/userReport/"+ contentTypeId +"/"+ contentId;
	
	var width  = 650;
	var height = 350;
	var left   = (screen.width  - width)/2;
	var top    = (screen.height - height)/2;
	var params = 'width='+width+', height='+height;
	params += ', top='+top+', left='+left;
	params += ', directories=no';
	params += ', location=no';
	params += ', menubar=no';
	params += ', resizable=yes';
	params += ', scrollbars=no';
	params += ', status=no';
	params += ', toolbar=no';
	window.open(url,'Report', params);
	return false;
}