/*SCRIPTS*/

//----------------------------------- DISCOGRAPHY ------------------------------

function popupSample(display,source){
	var samplewin = window.open("discography_sample.php?source=" + source + "&display=" + display, "sample", "height=100,width=340,directories=no,location=no,menubar=no,resizable=no,noresize,scrollbars=no,status=no,titlebar=no,toolbar=no");
	samplewin.focus();
}

//required to workaround new IE 6 security issue which popups a confirmation window before loading ActiveX controls
function renderQT(){
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="16" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ID="Qtactivexplugin1" viewastext="viewastext">');
	document.write('	<param name="src" value="'+mysource+'">');
	document.write('	<param name="cache" value="false">');
	document.write('	<param name="autoplay" value="false">');
	document.write('	<param name="controller" value="true">');
	document.write('	<embed src="'+mysource+'" cache="false" target="myself" pluginspage="http://www.apple.com/quicktime/download/" controller="true" autoplay="false" width="320" height="16" type="video/quicktime" />');
	document.write('</object>');
}

function renderMedia(source, type){
	var i_height;
	if(type == "video"){
		i_width = 320;
		i_height = 256;
	}else{
		i_width = 384;
		i_height = 16;
	}
	document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + i_width + '" height="' + i_height + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab" ID="Qtactivexplugin1" viewastext="viewastext">');
	document.write('	<param name="src" value="'+source+'">');
	document.write('	<param name="cache" value="false">');
	document.write('	<param name="autoplay" value="false">');
	document.write('	<param name="controller" value="true">');
	document.write('	<param name="scale" value="tofit">');
	document.write('	<embed src="'+source+'" cache="false" target="myself" pluginspage="http://www.apple.com/quicktime/download/" controller="true" autoplay="false" width="' + i_width + '" height="' + i_height + '" type="video/quicktime" scale="tofit" />');
	document.write('</object>');
}

//------------------------------------------------------------------------------



//------------------------------------- GALLERY --------------------------------
			
var arrGallery = new Array();
var galleryRange = 5;

function shot(name,desc){
	//alert(arrGallery.length);
	var i = arrGallery.length;
	arrGallery[i] = new Object();
	arrGallery[i].name = name;
	arrGallery[i].desc = desc;
	return arrGallery[i];
}

//Initialize the gallery
function initGallery(){
	refreshGallery();
	setLarge(galleryCurr);
}

//Paginate each page of thumbnails
function refreshGallery(){
	setLarge(0);
	for(i = 0; i < galleryRange; i++){
		if(arrGallery[(i + galleryPos)]) {
			document.images["small" + i].src = "images/x.gif";
			document.images["small" + i].src = "images/gallery/small/" + arrGallery[(i + galleryPos)].name;
			document.getElementById("th" + i).style.visibility = "visible";
		}else{
			document.images["small" + i].src = "images/x.gif";
			document.getElementById("th" + i).style.visibility = "hidden";
		}
	}
	//set prev and next button states
	document.getElementById("prev").style.visibility = "visible";
	document.getElementById("next").style.visibility = "visible";
	if(galleryPos < galleryRange){
		document.getElementById("prev").style.visibility = "hidden";
	}else if(galleryPos >= (arrGallery.length - galleryRange)){
		document.getElementById("next").style.visibility = "hidden";
	}
}

//page backward
function galleryPrev(){
	galleryPos -= galleryRange;
	refreshGallery();
}

//page forward
function galleryNext(){
	galleryPos += galleryRange;
	refreshGallery();
}

//zoom
function setLarge(num){
	document.images["large0"].src = "images/loading.gif";
	document.images["large0"].src = "images/gallery/large/" + arrGallery[galleryPos + num].name;
	document.getElementById("gallery-desc").innerHTML = arrGallery[galleryPos + num].desc;
	for(i=0;i<galleryRange;i++){
		document.getElementById("th" + i).className = "small off";
	}
	document.getElementById("th" + num).className = "small on";
}



//------------------------------------------------------------------------------