/*
	_library classes:
	$Revision: 1.4 $
*/

/*	TRIM SPACES	*/
function trim(str)	{
	return str.replace(/^\s*|\s*$/g,"");
}

function TheOpener(theUrl,WinName,width,height,scrollbar,resize,msgNoPopUp,goTo) {
//	theUrl 		= The page
//	width		= Width of the window
//	height		= Height of the windows
//	scroll		= Do You want the Scroll??? ][ Value = yes|no
//	resize		= Do You want to resize Window??? ][ Value = yes|no
//	msgNoPopUp	= set a message if popUp is not opened (aka blocked by a PopUp blocker)
//	goTo		= set a page where to go if popUp is not opened
//
// brought to you by []==ThoRŪ
//
	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

	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"					// -------------------
	// Open window
	var ThoR	= window.open(theUrl,WinName,winparams);
	if (ThoR==null || typeof(ThoR)=="undefined")	{
		if (msgNoPopUp != "")	{
			alert(msgNoPopUp);
		}
		if (goTo != "")	{
			location.href	= goTo;
		}
	} else {
		// Active window
		ThoR.focus();
	}
}

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 ('basket.php', '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"></a>';
	html += '</BODY></HTML>';
	w.document.open();
	w.document.write(html);
}

function goToFromPop(url)	{
	top.opener.location = url;
	self.close();
}

function _go(theUrl)	{
	ThoR	= window.open(theUrl,'theThor');
	ThoR.focus();
}


/*	FLASH WRITER	*/
function FlashWrite(url,width,height)
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
	document.write('  WIDTH=' + width + ' HEIGHT=' + height + '>');
	document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high>  ');
	document.write(' <EMBED src="' + url + '" quality=high  ');
	document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write(' </EMBED></OBJECT>');
}
