/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});
		$("#backgroundPopup").fadeIn("fast");
		$("#popupTagList").fadeIn("fast");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("fast");
		$("#popupTagList").fadeOut("fast");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#popupTagList").height();
	var popupWidth = $("#popupTagList").width();
	//centering
	$("#popupTagList").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	
}
////////////////////////////// VIDEO STUFF COPIED BY TRAVIS ///////////////////////////////////////////



function showvideoinline(thebox,thevid,thetarget,thename,theembed,thedesc){
	$('.videotarget').html('');			// get rid of all the old expanded videos
	// $('.vattachment').children('img').attr("src","http://hstatic.net/starfishcommunity.net/images/video_icon1.png");
	$('.vattachment').css({'display':''});
	// thevid.children('img').attr("src","http://hstatic.net/starfishcommunity.net/images/video_icon1bw.png");
	thevid.css({'display':'none'});
	thetarget.append("<div class='targetname'>" + thename + "</div>");
	thetarget.append("<div class='targetembed'>" + theembed + "</div>");
	thetarget.append("<div class='targetdesc'>" + thedesc + "</div>");
}














////////////////////////////// BELOW HERE IS ALL THE OLD STUFF ///////////////////////////////////////////

//SETTING UP OUR VIDEOPOPUP
//0 means disabled; 1 means enabled;
var popupVideoStatus = 0;


//loading video popup with jQuery magic!
function loadPopupVideo(vid){
	//loads popup only if it is disabled
	if(popupVideoStatus==0){
		$(".backgroundVideoPopup").css({
			"opacity": "0.4"
		});
		$(".backgroundVideoPopup").fadeIn("fast");
		$("#videoPopup_" + vid).fadeIn("fast");
		popupVideoStatus = 1;
	}
}

//disabling video popup with jQuery magic!
function disablePopupVideo(vid){
	//disables popup only if it is enabled
	if(popupVideoStatus==1){
		$(".backgroundVideoPopup").fadeOut("fast");
		$(".videoPopup").fadeOut("fast");
		popupVideoStatus = 0;
	}
}

//centering video popup
function centerPopupVideo(vid){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#videoPopup_" + vid).height();
	var popupWidth = $("#videoPopup_" + vid).width();
	//centering
	$("#videoPopup_" + vid).css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6
	
	$(".backgroundVideoPopup").css({
		"height": windowHeight
	});
	
}
