


// Load Back & print Button Image
back_on = new Image;
back_on.src = "../g/icons/back_on.gif";
back_off = new Image;
back_off.src = "../g/icons/back_off.gif";

print_on = new Image;
print_on.src = "../g/icons/print_on.gif";
print_off = new Image;
print_off.src = "../g/icons/print_off.gif";

mas_on = new Image;
mas_on.src = "../g/icons/mas_on.gif";
mas_off = new Image;
mas_off.src = "../g/icons/mas_off.gif";



// Swap Images
function Swap(i_name,i_src) {
//alert(i_name +" , "+ i_src);
	document[i_name].src=i_src;
}


// Dummy Function:
function Pass() {
	return
}

// --------------------------------- WINDOWS --------------------------------- //


function VerMas(thepage) {
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=510,height=560";
  var win = window.open(thepage,"news", options);
}


function BigCoverWindow(albumName) {
	var theUrl = "../cds/covers/" + albumName + "_360px.jpg";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=360,height=360";
 	var win = window.open(theUrl,"Portada", options);
/*  	win.document.write("<html><head><title>'Bicicletas de Marzo'<\/title><\/head><body>"); */
/*  	win.document.write("<img src='" + theUrl + "width='360' height='360'><\/body><\/html>"); */
}



function LyricsWindow(songName) {
	var theUrl = "../can/" + songName + ".htm";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=no,width=510,height=560";
 	var win = window.open(theUrl,"cancion", options);
}


function SongWindow(songName) {
	LyricsWindow(songName);
}


function PrintableWindow() {
	var theDiv = document.getElementById('actualContent');
	var theText = theDiv.innerHTML;
 	var win = window.open("","Printable");
 	win.document.write(theText);
}


function ChordsWindow(songName) {
	var theUrl = "../can/" + songName + "_ac.htm";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=510,height=560";
 	var win = window.open(theUrl,"cancion", options);
}



function AudioWindow(songName) {
	/* var theUrl = "../media/" + songName + ".mp3"; */
	var theUrl = "../can/" + songName + "_audio.htm";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=360,height=360";
 	var win = window.open(theUrl,"audio", options);

}

function VideoWindow(songName) {
	var theUrl = "../can/" + songName + "_video.htm";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=440,height=500";
 	var win = window.open(theUrl,"video", options);
}


function playMovie(theSong) {
	document.write('<object height="260" width="360" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">\n');
	document.write('<param name="src" value="../media/' + theSong + '_video.mov">\n');
	document.write('<param name="autoplay" value="true">\n');
	document.write('<param name="bgcolor" value="#9DA500">\n');
	document.write('<embed src="../media/' + theSong + '_video.mov" height="300" width="360" bgcolor="#9DA500" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"><\/embed> \n');
	document.write('<\/object>\n');
}




function PhotoWindow(photoNum) {
	var theUrl = "../f/" + photoNum + ".jpg";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=572,height=428";
 	var win = window.open(theUrl,"Foto", options);
}

function vPhotoWindow(photoNum) {
	var theUrl = "../f/" + photoNum + ".jpg";
	var options = "toolbar=0,status=0,menubar=0,scrollbars=0,resizable=1,width=428,height=572";
 	var win = window.open(theUrl,"Foto", options);
}


function openerTo(where) {
	opener.location.href = where;
	opener.focus();
}


// TRAP DOUBLE CLICK FUNCTION //
var secondsToRelease = 10;
var beenHit = 0;
var TrapTime = 0;

function trapDoubleClick(theForm) {
	theForm.submitButton.value = " procesando... ";
	beenHit++;
	var trapTheClick = (beenHit > 1) ? true : false;
	
	if(trapTheClick) {
		if (TrapTime == 0) {
			var tDate = new Date;
			TrapTime = tDate.valueOf();
		} else {
			var tDate = new Date;
			var localTrapTime = tDate.valueOf();
			if ((localTrapTime - TrapTime) > (secondsToRelease * 1000)) {
				TrapTime = 0;
				trapTheClick = false;
				beenHit = 0;
			}		
		}
	}
	return (trapTheClick) ? false : true;
}
