window.status = "Power by LEGOLASYSTEM S.A.C.";

var s = navigator.userAgent.toLowerCase();

function OpenFileBrowser( url, width, height ) {
	
	var iLeft = ( screen.width  - width ) / 2 ;
	var iTop  = ( screen.height - height ) / 2 ;

	var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
	sOptions += ",width=" + width ;
	sOptions += ",height=" + height ;
	sOptions += ",left=" + iLeft ;
	sOptions += ",top=" + iTop ;

	if ( false && (s.indexOf("ie") > -1) )
	{
		var oWindow = oEditor.window.open( url, 'FCKBrowseWindow', sOptions ) ;
    }
    else
		window.open( url, 'FCKBrowseWindow', sOptions ) ;
}


function InStr(strSearch, charSearchFor) {
	
		for (i=0; i < strSearch.length; i++)
		{
			  if (charSearchFor == Mid(strSearch, i, 1))
			  {
					return i;
			  }
		}
		return -1;
}

function Mid(str, start, len)
{
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}

function isMail(_email) {
	var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
	return emailReg.test(_email);
}

OpenDialog = function( BasePath, dialogName, dialogTitle, dialogPage, width, height, Control, parentWindow )
{
	
	// Setup the dialog info.
	var oDialogInfo = new Object() ;
	oDialogInfo.Title = dialogTitle ;
	oDialogInfo.Page = dialogPage ;
	oDialogInfo.Editor = window ;
	oDialogInfo.Control = Control ;		// Optional
	
	oDialogInfo.BasePath = BasePath;
	oDialogInfo.SkinPath = "/framework/fckeditor/editor/skins/default/";
	oDialogInfo.Dir = "ltr";
	
	var sUrl = BasePath + 'fckdialog_custom.html' ;
	Show( oDialogInfo, dialogName, sUrl, width, height, this.form ) ;
}

Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow )
{
	if ( !parentWindow )
		parentWindow = window ;
	
	var oReturn ;

	try
	{
		oReturn = parentWindow.showModalDialog( pageUrl, dialogInfo, "dialogWidth:" + dialogWidth + "px;dialogHeight:" + dialogHeight + "px;help:no;scroll:no;status:no") ;
	}
	catch( e ) 
	{}
}


function LoadScript( url )
{
	document.write( '<script type="text/javascript" src="' + url + '" onerror="alert(\'Error loading \' + this.src);"><\/script>' ) ;
}

ShowOpenDialog = function( dialogInfo, pageUrl, dialogWidth, dialogHeight, parentWindow )
{
	if ( !parentWindow )
		parentWindow = window ;
	
	var oReturn ;
	
	oReturn = parentWindow.showModalDialog(pageUrl , dialogInfo, "dialogWidth:" + dialogWidth + "px;dialogHeight:" + dialogHeight + "px;help:no;scroll:no;status:no") ;

}

function GoPage(url, page, type, target, w, h)
{		
	if (type == 0)
			window.open(url+"?page="+page, target, 'toolbar=no,status=no,resizable =no,scrollbars=yes,width=800,height=580');
			
	if (type == 1)
			window.open(url+"?dir="+page, target, "toolbar=no,status=no,resizable=no,scrollbars=yes,width="+w+",height="+h);
		
	/*if (type == 1)
		if (target == 0)
			window.location.replace(page);
		else
			window.open(page, 'Pandero', 'toolbar=no,status=no,resizable =no,scrollbars=yes,width=800,height=650');

	if (type == 2)
		if (target == 0)
			window.location.replace(page);
		else
			window.open(page + "?dir=" + mnuID, "Pandero", "toolbar=no,status=no,resizable=no,scrollbars=yes,width="+w+",height="+h);*/
}