function sendMail(thisExt, thisDomain, thisName) {
	//var mailWindow = window.open("mailto:" + thisName + "@" + thisDomain + "." + thisExt, "_blank")
	document.location.href = "mailto:" + thisName + "@" + thisDomain + "." + thisExt;
}

function showDescription(thisElement, thisDescription) {
	var clipRight
	if (thisElement == "description_docudrama") {
		clipRight = 132
	} else if (thisElement == "description_commercials") {
		clipRight = 140
	} else if (thisElement == "description_artmore") {
		clipRight = 148
	}
	document.getElementById(thisElement).innerHTML = '<span style="position:absolute; white-space: nowrap; clip:rect(0 ' + clipRight + 'px 20px 0); margin-top:6px;">' + thisDescription + '</span>';

}



function writeVideoViewer(activePlaylistID) {

	if (swfobject.hasFlashPlayerVersion("7.0.0")) { //http://code.google.com/p/swfobject/wiki/api
      var fn = function() {
        var att = { data:"videoplayer.swf", width:"100%", height:"100%" };
        var par = { flashvars:"lcId=" + lcId };
        var id = "videoPlayer";
        var myObject = swfobject.createSWF(att, par, id);
      };
      swfobject.addDomLoadEvent(fn);
    }
/*
if (usesFlash) {
		var so = new SWFObject("videoplayer.swf", "videoPlayerSwf", "100%", "100%", "7", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addVariable("lcId", lcId);
		so.addVariable("player_id", "19");
		so.write("videoPlayer");
		

	}
*/
	//alert(document.getElementById("videoPlayerSwf").clientWidth)
}

function thisMovie(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

function playMovie(objectID, repeat) {
	thisVideoArray = arrayFilter(videoArray, 0, objectID);

//flashProxy.call('playVideo', thisVideoArray[0][1], repeat);
	thisMovie('videoPlayer').sendToActionScript(thisVideoArray[0][1], repeat);

	
	document.getElementById("videoTitle").innerHTML = (thisVideoArray[0][3] =="") ? "" : "<h2 style=\"color:#799C13\">" + thisVideoArray[0][3] + "</h2>";
	document.getElementById("videoCompany").innerHTML = (thisVideoArray[0][4] =="") ? "" : "<h2>Production Company:</h2>&nbsp;" + thisVideoArray[0][4];
	document.getElementById("videoDirector").innerHTML = (thisVideoArray[0][5] =="") ? "" : "<h2>Director:</h2>&nbsp;" + thisVideoArray[0][5];
	document.getElementById("videoURL").innerHTML = (thisVideoArray[0][6] =="") ? "" : '<a href="' + thisVideoArray[0][6] + '" target="_blank">' + thisVideoArray[0][7] + '</a>';
	document.getElementById("videoText").innerHTML = (thisVideoArray[0][8] =="") ? "" : thisVideoArray[0][8];
}

function isArray() {
	// copied from http://www.planetpdf.com/developer/article.asp?ContentID=6383
	if (typeof arguments[0] == 'object') {  
		var criterion =  arguments[0].constructor.toString().match(/array/i); 
		return (criterion != null);
	}
	return false;
}
function arrayFilter(srcArray, fieldNr, filterValue) {
	var thisTempArray = new Array()
	var thisCounter = 0
	var thisLoopCounter, thisFLC

	if (isArray(filterValue)) { // isArray = true --> filter on array ### split 'splits' strings into arrays. splitting an array returns "undefined", i.e. null
		for (thisLoopCounter = 0; thisLoopCounter < srcArray.length; thisLoopCounter ++)  {
			if (srcArray[thisLoopCounter]) {
				for (thisFLC = 0; thisFLC < filterValue.length; thisFLC ++) {
					if (srcArray[thisLoopCounter][fieldNr] == filterValue[thisFLC][fieldNr]) {
						thisTempArray[thisCounter] = srcArray[thisLoopCounter]
						thisCounter ++
					}
				}
			}
		}
	} else {
		for (thisLoopCounter = 0; thisLoopCounter < srcArray.length; thisLoopCounter ++)  {
			if (srcArray[thisLoopCounter]) {
				if (srcArray[thisLoopCounter][fieldNr] == filterValue) {
					thisTempArray[thisCounter] = srcArray[thisLoopCounter]
					thisCounter ++
				}
			}
		}
	}
	return thisTempArray
}
