function viewImage (img,width,height) {
	var x = screen.availWidth
	var y = screen.availHeight
	var spaceSx = (x - width)/2
	//var spaceUp = 0										// To Point PopUp top
	var spaceUp = (y - height)/2							// To point PopUp in the center
	var w;
	img = img.src ? img.src : img;
	if (w && !w.closed)	w.close();
	scrollbar	= "no";
	resize		= "no";
	winparams	= ""										// Start Params for Window
	winparams	= winparams + "scrollbars=" 	+ scrollbar	// Scroll
	winparams 	= winparams + ",resizable=" 	+ resize	// Resizable
	winparams 	= winparams + ",left=" 			+ spaceSx	// Space From Left
	winparams 	= winparams + ",top=" 			+ spaceUp	// Space From Top
	winparams 	= winparams + ",width=" 		+ width		// Windowz Width
	winparams 	= winparams + ",height=" 		+ height	// Windowz Height
	winparams 	= winparams + ",directory=no"				// The Tool Bar Menu
	winparams 	= winparams + ",status=no"					//
	winparams 	= winparams + ",location=no"				//
	winparams 	= winparams + ",toolbar=no"					// -------------------
	w = open ('default.htm', 'imageView', winparams);
	var html = '';
	html += '<HTML><head><title>:: View Image::</title></head><BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
	html += '<a href="javascript:self.close();"><IMG SRC="' + img + '" border="0" width="' +(width-20)+ '" height="' +(height-20)+ '"></a>';
	html += '</BODY></HTML>';
	w.document.open();
	w.document.write(html);
}
//====================================================================================

function openImageWindow(imgFile, width, height) {
	if(!width) width=1000;
	if(!height) height= 700;

	imgWin = window.open ("","imagePreview","toolbar=no,scrollbars=yes,width=" + width + ",height=" + height);
	imgWin.document.write("<head><title>Image Preview</title><meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=windows-1251'>");
	imgWin.document.write("</head><body>");
	imgWin.document.write("<table cellspacing='' align='center'><tr>");
	imgWin.document.write("<td><img src='"+imgFile+"' width='" + (width-40) + "' height='" + (height-80) + "'/></td>");
	imgWin.document.write("</tr><tr><td align='center'>");
	imgWin.document.write("<br/><br/><input type='button' value='Затваряне на Прозореца' onClick='window.close();'/></td></tr></table>");
	imgWin.document.write("</td></tr></table>");
	imgWin.document.write("</body>");
}
//======================================================================================================

function allImgInOtherWindow() {
	var argv =  allImgInOtherWindow.arguments;
	var argc =  argv.length;

	imgWin = window.open ("","imagePreview","toolbar=no,scrollbars=yes,width=1000,height=700");
	imgWin.document.write("<table cellspacing='' align='center'><tr>");
	
	for(var i=1; i < argc; i++) {
		imgWin.document.write("<tr>");
		imgWin.document.write("<td align='center'><a href='/upload_box/previews1/"+argv[i]+"' target='_blank'><img src='/upload_box/previews/"+argv[i]+"'/></a><br/>"+i+"</td>");
		imgWin.document.write("</tr>");
	}
	imgWin.document.write("</table>");
}
//========================================================================================================




function selectFromGallery() {



}
//====================================================================================

function copyUrl(url) {
	var pasteArea = document.getElementById('fromGallery');

	pasteArea.value=url;

	//alert(pasteArea.value);
}
//===================================================================
