function LoadTmpHolder(Colour, imgArray, imgThumbArray, strAppend)	{
	var	i;
	for (i=0; i < imgArray.length; i++) {		
		if	(Colour	==	imgArray[i][3]){
			tmpHolder[0]	=	imgArray[i];
		}
	}
	if	(imgThumbArray[0] != null)	{
		tmpHolder[1] = imgThumbArray[0];
	} else {
		tmpHolder[1] = null;
	};

	if	(imgThumbArray[1] != null)	{
		tmpHolder[2] = imgThumbArray[1];
	} else {
		tmpHolder[2] = null;
	};
	if	(imgThumbArray[2] != null)	{
		tmpHolder[3] = imgThumbArray[2];
	} else {
		tmpHolder[3] = null;
	};
	if	(imgThumbArray[3] != null)	{
		tmpHolder[4] = imgThumbArray[3];
	} else {
		tmpHolder[4] = null;
	};
	if	(imgThumbArray[4] != null)	{
		tmpHolder[5] = imgThumbArray[4];
	} else {
		tmpHolder[5] = null;
	};
}
function ReplaceImageFromThumb(imgThumbIndex, strAppend) {

	mainImage = $('#ctl00_ContentMainPage_imgMainImage');
	
	HideZoomImage(strAppend);
	mainImage.attr('src','');

	var imgMedia = tmpHolder[imgThumbIndex];
	imgMedia = imgMedia.toString();
	imgMedia = imgMedia.split(',');
	imgMedia = imgMedia[2].toString();
	
	mainImage.attr('src',imgMedia);

//    $('#dvMainImageZoom').a($('#imgZoom_'+imgThumbIndex).html());
    $('#imgMainImageZoom').attr('src',$('#imgZoom_'+imgThumbIndex).attr('src'));
    
	
}


function ShowZoomImage(strAppend) {  //strAppend é inutil

    $('#ctl00_ContentMainPage_imgMainImage').hide();
    $('#dvMainImageZoom').show();
    clearTimeout(tZoomLoaded);
    setZoom('dvMainImageZoom', 'imgMainImageZoom');

}

function checkZoomLoaded(strAppend){

    //    alert("Append : "+strAppend);
    var statusImagem = oZoomImage.complete;

    if (oZoomImage.complete){

        alert('Controlador : '+ controlador);
        //$('#dvMainImageZoom' + strAppend).html = '<img id="imgMainImageZoom' + strAppend + '" src="' + oZoomImage.src + '" onclick="HideZoomImage()"/>';
        document.getElementById('dvMainImageZoom' + strAppend).innerHTML = '<img id="imgMainImageZoom' + strAppend + '" src="' + oZoomImage.src + '" onclick="HideZoomImage()"/>';

        clearTimeout(tZoomLoaded);
        $('#debugJsWs').html(document.getElementById('dvMainImageZoom' + strAppend).innerHTML);
        setZoom('dvMainImageZoom' + strAppend, 'imgMainImageZoom' + strAppend);

    }else{
            alert('Incompleta : '+statusImagem);
    }
}

function HideZoomImage(strAppend)	{

	mainImage = $('#ctl00_ContentMainPage_imgMainImage' + strAppend);
	mainImageZoom = $('#dvMainImageZoom' + strAppend);
	mainImageBox = $('dvMainImage' + strAppend);


	//if main image exists, show it
	if (mainImage) { mainImage.show(); }
	//hide the main image zoom box
	if (mainImageZoom) { mainImageZoom.hide(); }
	//if main image exists box exists, show it 
	if (mainImageBox) { mainImageBox.show(); }
	//TODO: add this back in when we have the new Creative core libs: HideVideo();
}
