/*Author: 		Daisy G. Montiel
 *Date: 		04/29/2008
 *Description: 	Used in cleo-product-noleft-wZoomEffect.html to supply the user a way to zoom in on product images. Product images should be no larger than 300px wide and about 400px in height. 
 
 The zoom image restriction is set to 450px wide / 550px height.
*/

function preloadLargeImage(url){
	var myImage = new Image(); 
	myImage.src = url;
}

function preloadLargeImages(urls){	
	var imageObj = new Image(); 
	var imageArray  = new Array();
	
	if ( urls.indexOf(",") ){	
		imageArray = urls.split(",");
		
		for(i=0; i<= imageArray.length; i++) {
			imageObj.src = imageArray[i];
		}
	}else{
		imageObj.src = urls;
	}		
}

function popup_window_by_index(url, i){	
	var imageArray  = new Array();	
	
	if ( urls.indexOf(",") ){	
		imageArray = url.split(",");
		popup( imageArray[i] );
	}else{
		popup( url );
	}		
}

function popup(url)
{	
	var myImage = new Image(); 
	myImage.src = url;

	if(myImage.complete){
		popup_window(myImage, myImage.width, myImage.height);
	}else{
		myImage.onload = popup_window(myImage, myImage.width, myImage.height);
	}
}

function popup_window(image, w, h){
	var myImage = new Image(); 
	myImage.src = image;
	var width = w +50;
	var height = h +100;
	//document.write("width: "+width);
	//document.write("height: "+height);
	var from_top=100;
	var from_left=200;
	var toolbar='no';
	var location='no';
	var directories='no';
	var status='no';
	var menubar='no';
	var scrollbars='yes';
	var resizable='yes';
	var atts='width='+width+',height='+height+',top='+from_top+',screenY=';
	atts+= from_top+',left='+from_left+',screenX='+from_left+',toolbar='+toolbar;
	atts+=',location='+location+',directories='+directories+',status='+status;
	atts+=',menubar='+menubar+',scrollbars='+scrollbars+',resizable='+resizable;
	
	myWin = open(myImage.src,'Large_Image',atts);	
	// open document for further output
	myWin.document.open();	
	// create document
	myWin.document.write("<html><head><title>Image Zoomed");
	myWin.document.write("</title></head><body>");
	myWin.document.write("<center>");
	myWin.document.write("<img src="+myImage.src+">");
	myWin.document.write("<br />");
	myWin.document.write("<br />");
	myWin.document.write("<p><a href='javascript:window.close();'>Close This Window</a></p>");	
	myWin.document.write("</center>");
	myWin.document.write("</body></html>");	
	// close the document - (not the window!)	
	myWin.document.close();
}