function toggleChecked(status) {
	jQuery("input:checkbox").each(function() {
		if (jq("ToggleSelectedAll").checked)
			this.setAttribute("checked", status);
		else
			this.removeAttribute("checked");
	});
}

function jq(id) {
	return document.getElementById(id);
}

function getSelectedProfiles() {
	var profile_string = "";

	var profiles = jQuery("input:checkbox:checked");

	if (jq("ToggleSelectedAll").checked)
		var j = parseInt(profiles.length) - 1;
	else
		var j = parseInt(profiles.length);

	for (i = 0; i < j; i++) {
		if(!isNaN(profiles[i].value)){
			profile_string += profiles[i].value + ",";
		}
	}

	return profile_string;
}

var enlargedTopRatePhotoId = null;

var enlargeTopRatedPhoto = function(photo_id) {
	if (enlargedTopRatePhotoId)
		lessenTopRatedPhoto(enlargedTopRatePhotoId);

	$('photo_' + photo_id + '_large').style.display = 'block';

	var size = 1;
	var dest = 100;
	var interval = 0;

	while (size < 300) {
		setTimeout("$('photo_" + photo_id + "_large').style.width = '" + size
				+ "px'; $('photo_" + photo_id + "_large').style.height = '"
				+ size + "px';", interval);

		size += 20;
		dest -= 10;

		interval += 10;
	}
	
	if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 7) {
		$("photo_" + photo_id + "_large").style.position = 'absolute';
		
		var offset = jQuery("#photo_container_" + photo_id).css('offset');
		
		$("photo_" + photo_id + "_large").style.top  = offset.top;
		$("photo_" + photo_id + "_large").style.left = offset.left;
	}
	else{
		$("photo_" + photo_id + "_large").style.position = 'absolute';
		$("photo_" + photo_id + "_large").style.top  = $("photo_container_" + photo_id).offsetTop + 30;
		$("photo_" + photo_id + "_large").style.left = $("photo_container_" + photo_id).offsetLeft;
	}
	
	$("photo_container_" + photo_id).style.disabled = true;

	enlargedTopRatePhotoId = photo_id;
}

var lessenTopRatedPhoto = function(photo_id) {
	var size = 300;
	var dest = -50;
	var interval = 0;

	while (size) {
		setTimeout("$('photo_" + photo_id + "_large').style.width = '" + size
				+ "px'; $('photo_" + photo_id + "_large').style.height = '"
				+ size + "px';", interval);

		size -= 20;
		dest += 10;

		interval += 9;
	}
	
	$("photo_container_" + photo_id).style.disabled = false;
	
	setTimeout("$('photo_" + photo_id + "_large').style.display = 'none'",interval);

	enlargedTopRatePhotoId = null;
}
