
function video_open(mov) {
	var so = new SWFObject("flash/mediaplayer/player.swf", "ply", "800", "470", "9", "#FFFFFF");
	so.addParam("allowfullscreen","true");
	so.addParam("allowscriptaccess","always");
	so.addParam("flashvars","file="+mov+"&autostart=true");
	so.write("popup_main");

}

function playlist_open(mov) {
	var so = new SWFObject("flash/playall.swf", "ply", "800", "470", "9", "#eeeeee");
	so.addParam("allowfullscreen","true");
	so.addParam("allowscriptaccess","always");
	so.write("popup_main");

}

function intro_open(content_id) {
	var so1 = new SWFObject("flash/intro.swf", "ply", "900", "344", "9", "#ffffff");
	so1.addParam("allowfullscreen","true");
	so1.addParam("allowscriptaccess","always");
	so1.addVariable("div",content_id);
	so1.write(content_id);
}		

function intro_close(content_id) {
	n=document.getElementById(content_id);
	n.innerHTML = "";
}

function gallery_open(content_id) {

	popup_div = document.getElementById('popup-gallery');
	fade_div = document.getElementById('popup-page_fade');
	
	photo = document.getElementById('popup_main_photo');

	if (photo != null) {
		photo.src = null;
		photo.style.display = "none";
	}
	
	var view1 = new Viewport();
	
	if (popup_div != null) {
		popup_div.style.top = (((view1.windowY - 489) / 2) + view1.scrollY) + "px";
		popup_div.style.left = ((view1.windowX - 836) / 2) + "px";

		popup_div.style.display = "block";
	}

	if (fade_div != null) {
		fade_div.style.height = view1.pageY + "px";
		fade_div.style.width = view1.pageX + "px";
		fade_div.style.display = "block";
	}
	
	url_var = "content_id=" + content_id;
	if (content_id == 'all') {
		playlist_open('video/asx.xml.php');
	} else {
		video_open(content_id);
	}
}





function gallery_close() {
	popup_div = document.getElementById('popup-gallery');
	fade_div = document.getElementById('popup-page_fade');
	
	photo = document.getElementById('popup_main_photo');
	caption = document.getElementById('popup_main_caption');
	
	items_div = document.getElementById('popup_thumbs_items');

	if (photo != null) {
		photo.src = null;
		photo.style.display = "none";
	}
	
	if (caption != null) {
		caption.innerHTML = null;
	}
	
	if (items_div != null) {
		items_div.style.top = "0px";
		items_div.innerHTML = null;
	}

	if (popup_div != null) {
		popup_div.style.display = "none";
	}

	if (fade_div != null) {
		fade_div.style.display = "none";
	}
}


function gallery_thumb_click(thumb) {
	photo = document.getElementById('popup_main_photo');
	caption = document.getElementById('popup_main_caption');
	
	thumb_caption_id = thumb.id + "_caption";
	
	thumb_caption = document.getElementById(thumb_caption_id);
	
	if (photo != null) {

		photo.src = thumb.src;
		
		if (photo.style.display=="none") {
			photo.style.display = "block";
		}
	}
	
	if (caption != null) {
		caption.innerHTML = thumb_caption.innerHTML;
	}

}



function gallery_scroll_at_top() {
	bt_up = document.getElementById('popup_thumbs_button_up');
	
	bt_up.style.display = "none";
}

function gallery_scroll_at_middle() {
	bt_up = document.getElementById('popup_thumbs_button_up');
	bt_down = document.getElementById('popup_thumbs_button_down');

	bt_up.style.display = "block";
	bt_down.style.display = "block";
}

function gallery_scroll_at_bottom() {
	bt_down = document.getElementById('popup_thumbs_button_down');

	bt_down.style.display = "none";
}