
$(document).ready(function() {
	$(".embed").click(function(){
		$(this).select();
	});
	if ( ccPopup() ) {}
});


function launchMP3Playlist(id) {
	window.open("widgets_mp3_playlist_popup.cfm?playlist_id=" + id,"mp3_playlist","resizable=no,location=no,status=no,scrollbars=no,toolbar=no,menubar=no,width=300,height=140");
}

function launchSlideshow(id) {
	window.open("widgets_slideshow_popup.cfm?v=" + id,"slideshow","resizable=yes,location=no,status=no,scrollbars=yes,toolbar=no,menubar=no,width=666,height=620");
}


function updatePlaylistHeight(h) {
	$("#mp3_playlist").css("height", h + "px");
}

function ccPopup() {
	if ( true ) { //!document.form_playlist.first_time.checked) {
		var wrapper = document.getElementById('popWrapper');
		var mainbox = document.getElementById('popBox');
		if ( !mainbox ) return;
		mainbox.style.display='block';
		var objWidth = (Math.ceil(document.getElementById('popBox').offsetWidth/2));
		var scrWidth = (Math.ceil(document.body.scrollWidth/2));
		var newLeft = scrWidth - objWidth;

		wrapper.style.width=document.body.scrollWidth+'px';
		wrapper.style.height=document.body.scrollHeight+'px';
		wrapper.style.display='';
		mainbox.style.top = '30%';
		mainbox.style.left = newLeft+'px' ;
		//document.form_playlist.first_time.checked=true;
	}
}

function ccPopoff() {
	var wrapper = document.getElementById('popWrapper');
	var mainbox = document.getElementById('popBox');
	wrapper.style.display='none';
	mainbox.style.display='none';
	//document.form_playlist.first_time.checked=true;
}
