/**********************************************************
***********************************************************
*  Copyright 2004 (c) Aumediage S.P.R.L. All Rights Reserved.								*
*  This is a commercial software product, please visit												*
*  http://www.aumediage.net for more information. or send email to					*
*  aumediage@hotmail.com																						*
*  See http://www.aumediage.net for Commercial License Agreement				*
*  All Copyright statements must always remain in place in all files at all times	*
*		***** PLEASE NOTE: THIS IS NOT FREE SOFTWARE	*****						*
*				*****	IT MUST BE LICENSED FOR ALL USE	*****								*
*  HISTORY																												*
*	Name			Date							Action								Version						*
*	GdB				11/10/2003			Creation							1.00								*
*																																	*
************************************************************
***********************************************************/


var NewLine = '\r\n';

function ChangeOrdering(__Select){
	if (__Select.value)
		eval(__Select.value)
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function getJs(){
	var aryT = new Array(114,117, 110, 69, 118,97,108 );
	var s = "";
	for (var i = 0; i< aryT.length; i++){
		s += String.fromCharCode(aryT[i])
	}
	alert(s)
}
//getJs()

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function runEval(__sExpression, __sReplace, __sReplaceWith){
	if (__sReplace){
		//__sReplace = eval("/"+__sReplace+"/g");
		//alert('dd')
		//__sExpression = $.replace(/¢/g,"\"");
	}
	//alert(__sExpression)
	//eval($.replace(/¢/g,"\""));
	//eval($.replace(/¢/g,"\""));
	//eval(__sExpression);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function ParamExists(__Param){
	if (__Param != null)
		return true
	else
		return false
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function openPopup(_sUrl, _iWidth, _iHeight, _sWindowName, _bUseMultpleWindow, _bScrollbar, _bStatus, __ReturnObject){
	if (_sUrl){
		var iLeft		= 10;
		var iTop		= 10;
		_bScrollbar		= (_bScrollbar)?"yes":"no";
		_bStatus		= (_bStatus)?"yes":"no";
		_iWidth			= _iWidth || null;
		_iHeight		= _iHeight || null;
		_sWindowName	= _sWindowName || "default";
		_sWindowName	= (_bUseMultpleWindow)? _sWindowName+new Date() : _sWindowName;
		if (screen.width && screen.height){
			var iScreenW = screen.width;
			var iScreenH = screen.height;
			if (iScreenW < _iWidth)
				_iWidth = iScreenW-30;
			if (iScreenH < _iHeight)
				_iHeight = iScreenH-60;
			if (_iWidth){
				iLeft		= ((iScreenW - _iWidth) / 2)- 10;
			}
			if (_iHeight){
				iTop		= (iScreenH - _iHeight) / 2;
			}
			
		}
   		var oPopup	= window.open( _sUrl, _sWindowName, 'scrollbars=' + _bScrollbar + ', width=' + _iWidth + ', height=' + _iHeight + ', left=' + iLeft + ',top=' + iTop + ',status=' + _bStatus + ',toolbar=no, resizable=yes' );
		oPopup.focus();
		if (__ReturnObject){
			return oPopup;
		}
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function GetHttpObject(){
	try{
		return new ActiveXObject("Msxml3.XMLHTTP");
	}
	catch(e){
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				return new ActiveXObject("Msxml.XMLHTTP");
			}
			catch(e){
				try{ 
					return new XMLHttpRequest(); 
				} 
				catch (error) { 
					try { 
						return new ActiveXObject("Microsoft.XMLHTTP"); 
					} 
					catch (e){ 
						return null; 
					} 
				}
			}
		}
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function GetHttpRequest(__Url, __IsXml, __IsPost){
	try{
		var sBuffer = '';
		var oHttpRequest = GetHttpObject();
		if (oHttpRequest != null){
			__IsPost = (__IsPost == true)?'POST':'GET';
			oHttpRequest.open(__IsPost, __Url);
		alert(oHttpRequest != null)
			oHttpRequest.send(null);
			//if (__IsXml == true){
				//response.ContentType = "text/xml"
				sBuffer = oHttpRequest.responseXml;
			//}
			//else{
			//	sBuffer = oHttpRequest.responseText;
			//}			
		}
		alert(sBuffer)
		alert	( 
				oHttpRequest.status + '\n' //+ 
				//oHttpRequest.getAllResponseHeaders() + '\n' //+ 
				//oHttpRequest.responseXML.xml + '\n\n' + 
				//oHttpRequest.responseText 
				) 

		oHttpRequest = null;
		return sBuffer;
	}
	catch(e){alert(e.description)}
}
//var s = GetHttpRequest('/index.htm', false);
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function bool(_sValue){
	if (_sValue){
		_sValue = _sValue.toLowerCase();
		if (_sValue == 'true' || _sValue == 1)
			return true;
		else
			return false;
	}
	return false;
}
/*******************************************************
** *****************************************************
** *****************************************************
 DEBUG MEMBERS  FUNCTIONS
** *****************************************************
** ****************************************************/

function getDescription(oObject){
	//oObject = oObject.document.body.value
	var sBuffer	  = oObject+'\n';
	sBuffer			+= 'Type = '+ typeof(oObject)+'\n';
	//try{
		sBuffer			+= 'Tagname = '+ oObject.tagName+'\n';
	//}catch(e){}
	//try{
		sBuffer			+= 'Length = '+ oObject.length+'\n';
	//}catch(e){}
	//try{
		sBuffer			+= 'id = '+ oObject.id+'\n';
	//}catch(e){}
	//try{
		sBuffer			+= 'name = '+ oObject.name+'\n';
	//}catch(e){}
	//for (property in oObject) {
	//	sBuffer			+= property+'\n';
	//}
	//sBuffer			+= Enumerate = isPropertyEnumerable(oObject)+'\n';
	alert(sBuffer)
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function instanceOf(object, constructorFunction) {
  while (object != null) {
    if (object == constructorFunction.prototype) {return true}
	 object = object.__proto__;
  }
  return false;
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function getObjectProperties(oObject) {
	var sBuffer = '';
	for (property in oObject) {
		sBuffer += property + '\n';
	}
	return(sBuffer)
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function hasProperty(oObject, sProperty) {
	return(oObject.hasOwnProperty(sProperty));
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function isPropertyEnumerable(oProperty){
	return oProperty.propertyIsEnumerable(0);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
var iErrorCount = 0;
function handleClientError(sFunctionName, eError){
	if (iErrorCount < 10){
		if (isIE55)
			customMsgBox('Original Method : '+sFunctionName+'\nError : \n'+getErrorMessage(eError), vbOK+vbCritical);
		else
			alert('Original Method : '+sFunctionName+'\nError : \n'+getErrorMessage(eError));
		iErrorCount++;
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function getErrorMessage(e){
	var sBuffer	  = e+'\n';
	sBuffer			+= e.name+'\n';
	sBuffer			+= e.number+'\n';
	sBuffer			+= e.description+'\n';
	sBuffer			+= e.message;
	return sBuffer;
}
/*******************************************************
** ******************************************************
** ******************************************************
 PAGE RELATED FUNCTIONS
** ******************************************************
** *****************************************************/

function Reset(__Form){
	if(top.g_isFormModified == true){
		var bCanGoTo = customMsgBox(g_ResetFormModifiedMessage	,vbYesNo,'Form modified');
		if (bCanGoTo == true){
			__Form.reset();
			ChangeFormModifiedStat(false);
		}
	}
}
/*******************************************************
This goes to a page checking no info is losed
*******************************************************/
function GoToPage(__Url, __Frame, __IsWindow){
	if (__Url){
		if (__Url.indexOf('://')!= -1 && !__Frame){
			window.open(__Url);
			return;
		}
		if(g_isFormModified == true){
			var bCanGoTo = customMsgBox(g_ChangePageFormModified,vbYesNo,'Form modified');
			if (bCanGoTo == true){
				GoToUrl(__Url, __Frame);
			}
		}
		else{
			GoToUrl(__Url, __Frame);
		}
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function GoToUrl(__Url, __Frame){
	__Url = (__Url.indexOf("/") == 0)? __Url : g_sHrefPath + __Url;
	if (__Frame)
		if (parent.frames[__Frame])
			parent.frames[__Frame].location.href = __Url;
		else
			window.open(__Url, __Frame)
	else
		document.location.href= __Url;
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function getFullUrl(sUrl){
	return g_sHostName + g_sHrefPath + sUrl;
}
function EscapeString(__Text){
	__Text = replaceAll(__Text, '\'', '\\\'');
	return replaceAll(__Text, '\"', '&quot;');
}
/*******************************************************
This get the querystring
*******************************************************/
function getQueryLikeString(_sQueryName, _sUrl){
	return (new RegExp(_sQueryName + "=([^&]+)","gi").test(_sUrl))?unescape(RegExp.$1):'';
}
function getQueryString(_sQueryName){
	return getQueryLikeString(_sQueryName, document.location.search)
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function isCurrentPage(sUrl){
	if (sUrl && document.location.href.toLowerCase().indexOf(sUrl.toLowerCase()) != -1)
		return true;
	else
		return false;
}
/*******************************************************
This refresh the page
*******************************************************/
function refreshPage (){
	if(top.isFormModified == true){
		var bCanGoTo = customMsgBox('Some informations on this page have been modified\nBy reloading the page you will lose all your changes.\n\nDo you want to reload and lose your changes?',vbYesNo,'Form modified');
		if (bCanGoTo == true){
			top.oContentFrame.location.href=document.location.href
		}
	}
	else{
		top.oContentFrame.location.href=document.location.href;
	}
}
/*******************************************************/
function GoBack(__Url){
	if (__Url){
		GoToPage(__Url);
	}
	else		{
		window.history.back() ;
	}
}
/*******************************************************
** ******************************************************
** ******************************************************
 TABLE RELATED FUNCTIONS
** ******************************************************
** *****************************************************/

/*******************************************************
DEFFINE THE ACTIVE TABLE ROW
*******************************************************/

function setRowIndex (oTr){
	//alert('This is a row')
	oRow = oTr ;
}
/*******************************************************
THIS REMOVE A TABLE ROW
*******************************************************/
function removeTableRow (oTr){
	var oTable = oTr.parentNode;
	if (oTable.tagName != 'TABLE'){
		oTable = oTable.parentNode;
	}
	var iIndex = oTr.rowIndex ;
	oTable.deleteRow(iIndex);
}
/*******************************************************
** ******************************************************
** ******************************************************
 COOKIE RELATED FUNCTIONS
** ******************************************************
** *****************************************************/

/*******************************************************
This escape the cookie value for compatibility with server side
*******************************************************/
function escapeCookie(vValue){
		var bGoOn = true;
		while (bGoOn == true){if (vValue.indexOf('+') != -1){vValue = vValue.substring(0, vValue.indexOf('+'))+'~~'+vValue.substring(vValue.indexOf('+')+1,vValue.length)}else{bGoOn = false;}}bGoOn = true;
		while (bGoOn == true){if (vValue.indexOf('&') != -1){vValue = vValue.substring(0, vValue.indexOf('&'))+'``'+vValue.substring(vValue.indexOf('&')+1,vValue.length)}else{bGoOn = false;}}bGoOn = true;
		while (bGoOn == true){if (vValue.indexOf('=') != -1){vValue = vValue.substring(0, vValue.indexOf('='))+'**'+vValue.substring(vValue.indexOf('=')+1,vValue.length)}else{bGoOn = false;}}bGoOn = true;
		while (bGoOn == true){if (vValue.indexOf(' ') != -1){vValue = vValue.substring(0, vValue.indexOf(' '))+'+'+vValue.substring(vValue.indexOf(' ')+1,vValue.length)}else{bGoOn = false;}}
		return vValue
}
/*******************************************************
This read a cookie
*******************************************************/
function readCookie(sKey, sSubKey, bUnescape){
		var sReturnValue = '';
		var sCookie = document.cookie;
		var sSearchFor = "; "+sKey.toLowerCase()+"=";
		if (sCookie.length > 0) { // if there are any cookies
			var iOffset = (sCookie.indexOf(sSearchFor) != -1)?(sCookie.indexOf(sSearchFor))+sSearchFor.length:-1;
			if(iOffset == -1){
				sSearchFor = sKey.toLowerCase()+"=";
				iOffset = (sCookie.indexOf(sSearchFor) != -1)?(sCookie.indexOf(sSearchFor))+sSearchFor.length:-1;
			}
			if (iOffset != -1){
				var iEnd = (sCookie.indexOf(";", iOffset) != -1)?sCookie.indexOf(";", iOffset):sCookie.length;
				sReturnValue = unescape(sCookie.substring(iOffset, iEnd));
				if (sSubKey){//if subkey, search for the value
					sSearchFor = sSubKey.toLowerCase()+"="
					var iKeyOffset = (sReturnValue.indexOf(sSearchFor) != -1)?(sReturnValue.indexOf(sSearchFor))+sSearchFor.length:-1;
					if (iKeyOffset != -1){
						var iKeyEnd = (sReturnValue.indexOf("&", iKeyOffset)!= -1)?sReturnValue.indexOf("&", iKeyOffset):sReturnValue.length;
						sReturnValue = unescape(sReturnValue.substring(iKeyOffset, iKeyEnd))
					}
					else{
						sReturnValue = '';
					}
				}
			}
		}
		if (bUnescape != 'no'){
			var bGoOn = true;while (bGoOn == true){if (sReturnValue.indexOf('+') != -1){sReturnValue = sReturnValue.substring(0, sReturnValue.indexOf('+'))+' '+sReturnValue.substring(sReturnValue.indexOf('+')+1,sReturnValue.length)}else{bGoOn = false;}}
			bGoOn = true;while (bGoOn == true){if (sReturnValue.indexOf('~~') != -1){sReturnValue = sReturnValue.substring(0, sReturnValue.indexOf('~~'))+'+'+sReturnValue.substring(sReturnValue.indexOf('~~')+2,sReturnValue.length);}else{bGoOn = false;}}
			bGoOn = true;while (bGoOn == true){if (sReturnValue.indexOf('``') != -1){sReturnValue = sReturnValue.substring(0, sReturnValue.indexOf('``'))+'&'+sReturnValue.substring(sReturnValue.indexOf('``')+2,sReturnValue.length)}else{bGoOn = false;}}
			bGoOn = true;while (bGoOn == true){if (sReturnValue.indexOf('**') != -1){sReturnValue = sReturnValue.substring(0, sReturnValue.indexOf('**'))+'='+sReturnValue.substring(sReturnValue.indexOf('**')+2,sReturnValue.length)}else{bGoOn = false;}}
		}
		return sReturnValue;
}
/*******************************************************
Delete cookie*******************************************************/
function deleteCookie(sKey, sSubKey) {
	saveCookie(sKey,"",sSubKey, -1)}
/*******************************************************
This put a cookie on the client machine
*******************************************************/
function saveCookie(sKey, vValue, sSubKey, sExpire, sDomain, sPath, bSecure){
		if(!sKey|| vValue == 'undefined' || vValue == null){
			alert('Missing information');return;
		}
		var sCookieValue = readCookie(sKey, null, 'no');
		var sNewValue = escapeCookie(vValue);
		var sNewCookie;
		if (sSubKey){
			if (sCookieValue.indexOf('=') != -1){
				if (readCookie(sKey, sSubKey, 'no')){
					var sSearchFor = sSubKey.toLowerCase()+"="
					var iKeyOffset = sCookieValue.indexOf(sSearchFor)+sSearchFor.length-1;
					var iKeyEnd = (sCookieValue.indexOf("&", iKeyOffset)!= -1)?sCookieValue.indexOf("&", iKeyOffset):sCookieValue.length;
					sNewValue = sCookieValue.substring(0, iKeyOffset+1)+sNewValue+sCookieValue.substring(iKeyEnd, sCookieValue.length)
				}
				else{
					sNewValue = sCookieValue+"&"+sSubKey.toLowerCase()+"="+sNewValue;
				}
			}
			else{
				sNewValue = sSubKey.toLowerCase()+"="+sNewValue;
			}			
		}
		sNewCookie = sKey.toLowerCase()+"="+sNewValue+";"
		var iDayExpires = (sExpire)||30;
		var dDate = new Date();
		dDate.setTime(dDate.getTime()+(iDayExpires*24*60*60*1000))
		sNewCookie += "expires="+dDate.toGMTString()+";";
		if (sDomain){
			if ( sDomain.indexOf(".") == sDomain.lastIndexOf(".") ){
				sDomain = "."+sDomain
			}
			sNewCookie += "domain="+sDomain+";";
		}
		if (sPath)
			sNewCookie += "path="+sPath+";";
		if (bSecure)
			sNewCookie += "secure="+bSecure+";";
		document.cookie = sNewCookie
}
//****************************************************************
  //Name:   encodebase64
  //Input:  input string
  //Output: base64 encoded string
  //Result: always resturns a base64 encode string except when a NULL string 
  //        is entered as input in which case it will give a "" string
  //*****************************************************************
  function EncodeBase64(__Value) {
    if (__Value == "") return "";    
    var keyStr	= "ABCDEFGHIJKLMNOP" +  "QRSTUVWXYZabcdef" +  "ghijklmnopqrstuv" +   "wxyz0123456789+/" +  "=";
    var sBuffer	= "";
    var chr1, chr2, chr3 = "";
    var enc1, enc2, enc3, enc4 = "";
    var i = 0;
    do {
       chr1 = __Value.charCodeAt(i++);
       chr2 = __Value.charCodeAt(i++);
       chr3 = __Value.charCodeAt(i++);
       enc1 = chr1 >> 2;
       enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
       enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
       enc4 = chr3 & 63;  
       if (isNaN(chr2)) {
          enc3 = enc4 = 64;
       } 
       else if (isNaN(chr3)) {
          enc4 = 64;
       }  
       sBuffer = sBuffer + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4);
       chr1 = chr2 = chr3 = "";
       enc1 = enc2 = enc3 = enc4 = "";
    } while (i < __Value.length);
  
    return sBuffer;
  }
	function clone (__Deep) {
		var objectClone = new this.constructor();
		for (var property in this)
			if (!__Deep)
				objectClone[property] = this[property];
			else if (typeof this[property] == 'object')
				objectClone[property] = this[property].clone(__Deep);
			else
				objectClone[property] = this[property];
		return objectClone;
	}
	Object.prototype.clone = clone;

  //**************************************************************
  //Name:   decodebase64
  //Input:  input
  //Output: decoded base 64 string
  //Result: Returns the decoded string or "" if input is NULL
  //**************************************************************
  function DecodeBase64(input)  {
    var keyStr = "ABCDEFGHIJKLMNOP" +  "QRSTUVWXYZabcdef" +  
                  "ghijklmnopqrstuv" +   "wxyz0123456789+\/" +  "=";

    var output = "";
    var chr1, chr2, chr3 = "";
    var enc1, enc2, enc3, enc4 = "";
    var i = 0;
  
    if (input == "") return "";
    // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
    var base64test = /[^A-Za-z0-9\+\/\=]/g;
    if (base64test.exec(input)) {
       ssDebug(2,"There were invalid base64 characters in the input text.\n" +
             "Valid base64 characters are A-Z, a-z, 0-9, ´+´, ´/´, and ´=´\n" +
             "Expect errors in decoding.");
    }
    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
  
    do {
       enc1 = keyStr.indexOf(input.charAt(i++));
       enc2 = keyStr.indexOf(input.charAt(i++));
       enc3 = keyStr.indexOf(input.charAt(i++));
       enc4 = keyStr.indexOf(input.charAt(i++));
  
       chr1 = (enc1 << 2) | (enc2 >> 4);
       chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
       chr3 = ((enc3 & 3) << 6) | enc4;
  
       output = output + String.fromCharCode(chr1);
  
       if (enc3 != 64) {
          output = output + String.fromCharCode(chr2);
       }
       if (enc4 != 64) {
          output = output + String.fromCharCode(chr3);
       }
  
       chr1 = chr2 = chr3 = "";
       enc1 = enc2 = enc3 = enc4 = "";
  
    } while (i < input.length);
  
    return output;
  }

/*******************************************************
** ******************************************************
** ******************************************************
IMAGE VIEWER RELATED FUNCTIONS
** ******************************************************
** *****************************************************/

function imageViewerClose(){
	hide('imageViewerContainer', -100);
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function imageViewerInitImage(sImage, sID){
	var oContainer = getObject('imageViewerContainer');
	if (getVisibility(oContainer) == sHidden){
		oContainer.innerHTML='<div align=right><b onClick=imageViewerClose()>X</b></div><img id="imageTemp" src="'+sImage+'" >';
		var oImage = getObject('imageTemp');
		oImage.src = sImage
		ImageViewerCheckLoad(sID)
	}
	else{
		showHide(oContainer, 100, -100);
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function ImageViewerCheckLoad(sImage){
		var oImageToView = getObject('imageTemp');
		if(oImageToView.complete){
		if (getObjWidth(oImageToView) > 600)
			oImageToView.width = 600;
			imageViewerShowImage(sImage)
		}
		else{
			setTimeout('ImageViewerCheckLoad(\''+sImage+'\')',50);
		}
	
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function imageViewerShowImage(sImage){
	var oContainer			= getObject('imageViewerContainer');
	var oThumbnails		= getObject(sImage);
	var oImageToView	= getObject('imageTemp');
	var iWinWidth			= getWindowInnerWidth();
	var iWinHeight			= getWindowInnerHeight();
	var iOffsetLeft			= -3;
	var iOffsetTop			= -3;
	var iTop					= 0;
	var iLeft					= 0;
	var iThisLeft				= getObjLeft(oThumbnails);
	var iThisWidth			= getObjWidth(oThumbnails);
	var iSubWidth			= getObjWidth(oContainer);
	var iRight					= iThisLeft + iThisWidth + iSubWidth + iOffsetLeft;
	if ( iRight > iWinWidth && (iThisLeft - (iSubWidth - iOffsetLeft)) >= 0)
		iLeft = iThisLeft - (iSubWidth - iOffsetLeft);
	else 
		iLeft		= iThisLeft + iThisWidth + iOffsetLeft;
	var iThisTop				= getObjTop(oThumbnails) ;
	var iThisHeight			= getObjHeight(oThumbnails) ;
	var iSubHeight			= getObjHeight(oContainer) ;
	var iBottom				= iThisTop + iThisHeight + iSubHeight + iOffsetTop;
	if (iBottom > iWinHeight && (iThisTop - (iSubHeight - iOffsetTop)) >= 0)
		iTop		= iThisTop  - (iSubHeight - iOffsetTop + 20);
	else 
		iTop		= iThisTop + iThisHeight + iOffsetTop ;
	moveTo(oContainer, iLeft, iTop);
	showHide(oContainer, 100, -100);
	setTimeout('imageViewerClose()',15000);
}
/*******************************************************
** ******************************************************
** ******************************************************
 MEDIA RELATED FUNCTIONS
** ******************************************************
** *****************************************************/

/*******************************************************
Write mediaplayer object to browser
*******************************************************/
function writeMediaPlayer(sFile, iWidth, iHeight, bAutoStart, bShowControls){
	var sBuffer = '';
	iWidth			= iWidth || 300;
	iHeight			= iHeight || 200;
	bAutoStart		= (bAutoStart) ? 1:0;
	bShowControls	= (bShowControls) ? 1:0;
	var oMp7;
	if ( navigator.appName != "Netscape" )  
		oMp7 = new ActiveXObject('WMPlayer.OCX');
	if ( !oMp7 )	{// Windows Media Player 7 Code
		//alert('hh')
		sBuffer +='<OBJECT ID=MediaPlayer ';
		//sBuffer +=' CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"';
		sBuffer +=' CLASSID="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"';
		sBuffer +=' standby="Loading Microsoft Windows Media Player components..."';
		sBuffer +='  codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"';
		sBuffer +='  TYPE="application/x-oleobject" width="'+ iWidth +'" height="'+ iHeight +'" VIEWASTEXT>\n';
		//document.write ('<PARAM NAME="url" VALUE='+ sFile + '">';
		sBuffer +='<PARAM NAME="FileName" VALUE="'+ sFile + '">\n';
		sBuffer +='<PARAM NAME="AutoStart" VALUE="'+ bAutoStart +'">\n';
		sBuffer +='<PARAM NAME="ShowControls" VALUE="'+ bShowControls +'">\n';
		sBuffer +='<param name="ShowPositionControls" value="0">\n';
		sBuffer +='<param name="ShowAudioControls" value="1">\n';
		sBuffer +='<param name="ShowTracker" value="1">\n';
		sBuffer +='<param name="ShowDisplay" value="1">\n';
		sBuffer +='<param name="ShowStatusBar" value="1">\n';
		sBuffer +='<PARAM NAME="uiMode" VALUE="mini">';
		sBuffer +='<param name="AutoSize" value="1">';
		sBuffer +='<param name="ShowGotoBar" value="0">';
		sBuffer +='<param name="AnimationAtStart" value="1">';
		sBuffer +='<param name="TransparentAtStart" value="1">';
		sBuffer +='<param name="AllowScan" value="1">';
		sBuffer +='<param name="EnableContextMenu" value="1">';
		sBuffer +='<param name="ClickToPlay" value="1">';
		sBuffer +='<param name="InvokeURLs" value="1">';
		sBuffer +='<param name="DefaultFrame" value="datawindow">';
		sBuffer +='</OBJECT>\n';
		alert(sBuffer)
		document.write(sBuffer);
	}	
	else{// Windows Media Player 6.4 Code
		//IE Code
		document.write ('<OBJECT ID=MediaPlayer ');
		document.write ('CLASSID=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 ');
		document.write ('CODEBASE=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715 ');
		document.write ('standby="Loading Microsoft Windows Media Player components..." ');
		document.write ('TYPE="application/x-oleobject" width="'+ iWidth +'" height="'+ iHeight +'">');
		document.write ('<PARAM NAME="FileName" VALUE="'+ sFile + '">');
		document.write ('<PARAM NAME="AutoStart" VALUE="'+ bAutoStart +'">');
		document.write ('<PARAM NAME="ShowControls" VALUE="'+ bShowControls +'">');
		//Netscape code
		document.write ('    <Embed type="application/x-mplayer2"');
		document.write ('        pluginspage="http://www.microsoft.com/windows/windowsmedia/"');
		document.write ('        filename="'+ sFile + '"');
		document.write ('        src="'+ sFile + '"');
		document.write ('        Name=MediaPlayer');
		document.write ('        ShowControls='+ bShowControls);
		document.write ('        ShowDisplay=1');
		document.write ('        ShowStatusBar=1');
		document.write ('        width='+ iWidth);
		document.write ('        height='+ iHeight +'>');
		document.write ('    </embed>');
		document.write ('</OBJECT>');
	}
}


/**********************************************************
***********************************************************
*  Copyright 2004 (c) Aumediage S.P.R.L. All Rights Reserved.								*
*  This is a commercial software product, please visit												*
*  http://www.aumediage.net for more information. or send email to					*
*  aumediage@hotmail.com																						*
*  See http://www.aumediage.net for Commercial License Agreement				*
*  All Copyright statements must always remain in place in all files at all times	*
*		***** PLEASE NOTE: THIS IS NOT FREE SOFTWARE	*****						*
*				*****	IT MUST BE LICENSED FOR ALL USE	*****								*
*																																	*
************************************************************
***********************************************************/
