﻿String.prototype.Contains = function( textToCheck )
{
	return ( this.indexOf( textToCheck ) > -1 ) ;
}
var s = navigator.userAgent.toLowerCase() ;
 
var IFBrowserInfo = 
{
	IsIE		: s.Contains('msie'),
	IsIE7		: s.Contains('msie 7'),
	IsGecko		: s.Contains('gecko/'),
	IsSafari	: s.Contains('safari'),
	IsOpera		: s.Contains('opera')
}

IFBrowserInfo.IsGeckoLike = IFBrowserInfo.IsGecko || IFBrowserInfo.IsSafari || IFBrowserInfo.IsOpera ;

if ( IFBrowserInfo.IsGecko )
{
	var sGeckoVersion = s.match( /gecko\/(\d+)/ )[1] ;
	IFBrowserInfo.IsGecko10 = sGeckoVersion < 20051111 ;	// Actually "10" refers to versions before Firefox 1.5, where Gecko 20051111 has been released.
}

var IFColorCommand = function(panel, obj )
{
    this.Obj =obj;
	//this.Name = type == 'ForeColor' ? 'TextColor' : 'BGColor' ;
	//this.Type = type ;
    
	var oWindow ;
	
if ( IFBrowserInfo.IsIE )
		oWindow = window ;
	//else if ( FCK.ToolbarSet._IFrame )
	//	oWindow = FCKTools.GetElementWindow( FCK.ToolbarSet._IFrame ) ;
	else
	//oWindow =  GetElementWindow( "bodyProxy" ) ;
 
	 oWindow = window.parent ;
	
 curObj=obj;
 this.Panel=panel;
 curPal=panel;
	this._Panel = new IFPanel( oWindow, true ) ;
	this._Panel.AppendStyleSheet( '/admin/'+ 'color.css' ) ;
	 this._Panel.MainNode.className = 'IF_Panel' ;
	this._CreatePanelBody( this._Panel.Document, this._Panel.MainNode ) ;
	 IFTools.DisableSelection( this._Panel.Document.body ) ;
}
var curPal;
IFColorCommand.prototype.Execute = function( panelX, panelY, relElement )
{
	// We must "cache" the actual panel type to be used in the SetColor method.
	//IF._ActiveColorPanelType = this.Type ;

	// Show the Color Panel at the desired position.
	this._Panel.Show( panelX, panelY, relElement ) ;
}

function IFColorCommand_OnMouseOver()	{ this.className='ColorSelected' ; }

function IFColorCommand_OnMouseOut()	{ this.className='ColorDeselected' ; }

function IFColorCommand_OnClick()
{
	this.className = 'ColorDeselected' ;
	 this.Command.SetColor( '#' + this.Color ) ;
	this.Command._Panel.Hide() ;
}

function IFColorCommand_AutoOnClick()
{
	 this.className = 'ColorDeselected' ;
	 this.Command.SetColor( '' ) ;
	 this.Command._Panel.Hide() ;
}
 
function IFColorCommand_MoreOnClick()
{
	 this.className = 'ColorDeselected' ;
	 this.Command._Panel.Hide() ;
	 //alert('test');
	 IFDialog.OpenDialog( 'Dialog_Color','选择颜色', 'colors.html', 400, 330, this.Command.SetColor ) ;
}
var IFDialog = new Object() ;
IFDialog.Show=function(A,B,C,D,E,F){
if (!F) F=window;
 var G=F.showModalDialog(C,A,"dialogWidth:"+D+"px;dialogHeight:"+E+"px;help:no;scroll:no;status:no");
 
 }

// This method opens a dialog window using the standard dialog template.
IFDialog.OpenDialog = function( dialogName, dialogTitle, dialogPage, width, height, customValue, parentWindow, resizable )
{
	// Setup the dialog info.
	var oDialogInfo = new Object() ;
	oDialogInfo.Title = dialogTitle ;
	oDialogInfo.Page = dialogPage ;
	oDialogInfo.Editor = window ;
	oDialogInfo.CustomValue = customValue ;		// Optional
	
	var sUrl =  '../admin/colors.html?'+new Date() ;
	openWindow(sUrl,'380px','280px','选择颜色',true);
	//this.Show( oDialogInfo, dialogName, sUrl, width, height, parentWindow, resizable?resizable:window) ;
}



var defaultColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ;
IFColorCommand.prototype._CreatePanelBody = function( targetDocument, targetDiv )
{
	function CreateSelectionDiv()
	{
		var oDiv = targetDocument.createElement( "DIV" ) ;
		oDiv.className		= 'ColorDeselected' ;
		oDiv.onmouseover	= IFColorCommand_OnMouseOver ;
		oDiv.onmouseout		= IFColorCommand_OnMouseOut ;
		
		return oDiv ;
	}

	var oTable = targetDiv.appendChild( targetDocument.createElement( "TABLE" ) ) ;
	oTable.className = 'ForceBaseFont' ;		// Firefox 1.5 Bug.
	oTable.style.tableLayout = 'fixed' ;
	oTable.cellPadding = 0 ;
	oTable.cellSpacing = 0 ;
	oTable.border = 0 ;
	oTable.width = 150 ;

	var oCell = oTable.insertRow(-1).insertCell(-1) ;
	oCell.colSpan = 8 ;

	// Create the Button for the "Automatic" color selection.
	var oDiv = oCell.appendChild( CreateSelectionDiv() ) ;
	oDiv.innerHTML = 
		'<table cellspacing="0" cellpadding="0" width="100%" border="0">\
			<tr>\
				<td><div class="ColorBoxBorder"><div class="ColorBox" style="background-color: #000000"></div></div></td>\
				<td nowrap width="100%" align="center" style="font-size:12px">自动</td>\
			</tr>\
		</table>' ;

	oDiv.Command = this ;
	oDiv.onclick = IFColorCommand_AutoOnClick ;

	// Create an array of colors based on the configuration file.
	var aColors = defaultColors.split(',') ;

	// Create the colors table based on the array.
	var iCounter = 0 ;
	 
	while ( iCounter < aColors.length )
	{
		var oRow = oTable.insertRow(-1) ;
		
		for ( var i = 0 ; i < 8 && iCounter < aColors.length ; i++, iCounter++ )
		{
			oDiv = oRow.insertCell(-1).appendChild( CreateSelectionDiv() ) ;
			oDiv.Color = aColors[iCounter] ;
			oDiv.innerHTML = '<div class="ColorBoxBorder"><div class="ColorBox" style="background-color: #' + aColors[iCounter] + '"></div></div>' ;
 
			oDiv.Command = this ;
			oDiv.onclick = IFColorCommand_OnClick ;
		}
	 
		 
	}

	// Create the Row and the Cell for the "More Colors..." button.
	oCell = oTable.insertRow(-1).insertCell(-1) ;
	oCell.colSpan = 8 ;

	oDiv = oCell.appendChild( CreateSelectionDiv() ) ;
	oDiv.innerHTML = '<table width="100%" cellpadding="0" cellspacing="0" border="0"   ><tr><td nowrap align="center" style="font-size:12px" width="100%">其他颜色...</td></tr></table>' ;

	oDiv.Command = this ;
	oDiv.onclick = IFColorCommand_MoreOnClick ;
 
}
var curObj=null;
IFColorCommand.prototype.SetColor = function( color )
{
if(curPal)
{
 curPal.style.background=color;
}
if(curObj)
{  //curObj.style.background=color;
curObj.value=color;
curObj.onclick();
}
}
//stylewindow


var IFPanel = function( parentWindow )
{
	this.IsRTL			= true;//( IFLang.Dir == 'rtl' ) ;
	this.IsContextMenu	= false ;
	this._LockCounter	= 0 ;
	
	this._Window = parentWindow || window ;
	
	var oDocument ;
	
	if ( IFBrowserInfo.IsIE) 
	{   
		// Create the Popup that will hold the panel.
		this._Popup	= this._Window.createPopup() ;
		oDocument = this.Document = this._Popup.document ;
	}
	else
	{
		var oIFrame = this._IFrame = this._Window.document.createElement('iframe') ; 
		oIFrame.src					= 'javascript:void(0)' ;
		oIFrame.allowTransparency	= true ;
		oIFrame.frameBorder			= '0' ;
		oIFrame.scrolling			= 'no' ;
		oIFrame.style.position		= 'absolute';
		oIFrame.style.zIndex		= 200000; 
		oIFrame.width = oIFrame.height =0 ;
        oIFrame.style.height='auto';
		if ( this._Window == window.parent )
			window.parent.document.body.insertBefore( oIFrame, window.frameElement ) ;
		else
			this._Window.document.body.appendChild( oIFrame ) ;
		
		var oIFrameWindow = oIFrame.contentWindow ; 
		
		oDocument = this.Document = oIFrameWindow.document ;

		oDocument.open() ;
		oDocument.write( '<html><head></head><body style="margin:0px;padding:0px;"><\/body><\/html>' ) ;
		oDocument.close() ;
        IFTools.AddEventListenerEx( oIFrameWindow, 'focus', IFPanel_Window_OnFocus, this ) ;
		IFTools.AddEventListenerEx( oIFrameWindow, 'blur', IFPanel_Window_OnBlur, this ) ;
	}
	// Create the main DIV that is used as the panel base.
	this.MainNode = oDocument.body.appendChild( oDocument.createElement('DIV') ) ;

	// The "float" property must be set so Firefox calculates the size correcly.
	this.MainNode.style.cssFloat = this.IsRTL ? 'right' : 'left' ;
	
		
;
}


IFPanel.prototype.AppendStyleSheet = function( styleSheet )
{
	 
	var e = this.Document.createElement( 'link' ) ;
	e.rel	= 'stylesheet' ;
	e.type	= 'text/css' ;
	e.href	= styleSheet+'?'+new Date();
 
	this.Document.getElementsByTagName("head")[0].appendChild( e ) ;
 
	return e ;
}

IFPanel.prototype.Preload = function( x, y, relElement )
{
	// The offsetWidth and offsetHeight properties are not available if the 
	// element is not visible. So we must "show" the popup with no size to
	// be able to use that values in the second call (IE only).
	if ( this._Popup )
		this._Popup.show( x, y, 0, 0, relElement ) ;
}

IFPanel.prototype.Show = function( x, y, relElement, width, height )
{
	if ( this._Popup )
	{
		// The offsetWidth and offsetHeight properties are not available if the 
		// element is not visible. So we must "show" the popup with no size to
		// be able to use that values in the second call.
		this._Popup.show( x, y, 0, 0, relElement ) ;

		// The following lines must be place after the above "show", otherwise it 
		// doesn't has the desired effect.
		this.MainNode.style.width	= width ? width + 'px' : '' ;
		this.MainNode.style.height	= height ? height + 'px' : '' ;
		
		var iMainWidth = this.MainNode.offsetWidth ;

		if ( this.IsRTL )
		{
			if ( this.IsContextMenu )
				x  = x - iMainWidth + 1 ;
			else if ( relElement )
				x  = ( x * -1 ) + relElement.offsetWidth - iMainWidth ;
		}
	
		// Second call: Show the Popup at the specified location, with the correct size.
		this._Popup.show( x, y, iMainWidth, this.MainNode.offsetHeight, relElement ) ;
		
		if ( this.OnHide )
		{
			if ( this._Timer )
				CheckPopupOnHide.call( this, true ) ;

			 this._Timer = IFTools.SetInterval( CheckPopupOnHide, 100, this ) ;
		}
	}
	else
	{
	;

		if ( this.ParentPanel )
			this.ParentPanel.Lock() ;

		this.MainNode.style.width	= width ? width + 'px' : '' ;
		this.MainNode.style.height	= height ? height + 'px' : '' ;

		var iMainWidth = this.MainNode.offsetWidth ;

		if ( !width )	this._IFrame.width	= 1 ;
		if ( !height )	this._IFrame.height	= 1 ;

		// This is weird... but with Firefox, we must get the offsetWidth before
		// setting the _IFrame size (which returns "0"), and then after that,
		// to return the correct width. Remove the first step and it will not
		// work when the editor is in RTL.
		iMainWidth = this.MainNode.offsetWidth ;

		var oPos = GetElementPosition( ( relElement.nodeType == 9 ? relElement.body : relElement), this._Window ) ;

		if ( this.IsRTL && !this.IsContextMenu )
			x = ( x * -1 ) ;

		x += oPos.X ;
		y += oPos.Y ;

		if ( this.IsRTL )
		{
			if ( this.IsContextMenu )
				x  = x - iMainWidth + 1 ;
			else if ( relElement )
				x  = x + relElement.offsetWidth - iMainWidth ;
		}
		else
		{
			var oViewPaneSize = IFTools.GetViewPaneSize( this._Window ) ;
			var oScrollPosition = IFTools.GetScrollPosition( this._Window ) ;
			
			var iViewPaneHeight	= oViewPaneSize.Height + oScrollPosition.Y ;
			var iViewPaneWidth	= oViewPaneSize.Width + oScrollPosition.X;

			if ( ( x + iMainWidth ) > iViewPaneWidth )
				x -= x + iMainWidth - iViewPaneWidth ;

			if ( ( y + this.MainNode.offsetHeight ) > iViewPaneHeight )
				y -= y + this.MainNode.offsetHeight - iViewPaneHeight ;
		}
		
		if ( x < 0 )
			 x = 0 ;

		// Set the context menu DIV in the specified location.
		this._IFrame.style.left	= x + 'px' ;
		this._IFrame.style.top	= y + 'px' ;
		
		var iWidth	= iMainWidth+10 ;
		var iHeight	= this.MainNode.offsetHeight ;
		
		this._IFrame.width	= iWidth ;
		this._IFrame.height = iHeight ;

		// Move the focus to the IFRAME so we catch the "onblur".
		this._IFrame.contentWindow.focus() ;
	}

	this._IsOpened = true ;

	IFTools.RunFunction( this.OnShow, this ) ;
}
function GetElementPosition   ( el, relativeWindow )
{
	// Initializes the Coordinates object that will be returned by the function.
	var c = { X:0, Y:0 } ;
	
	var oWindow = relativeWindow || window ;

	// Loop throw the offset chain.
	while ( el )
	{
		c.X += el.offsetLeft - el.scrollLeft ;
		c.Y += el.offsetTop - el.scrollTop  ;

		if ( el.offsetParent == null )
		{
			var oOwnerWindow = GetElementWindow( el ) ;
			
			if ( oOwnerWindow != oWindow )
				el = oOwnerWindow.frameElement ;
			else
			{
				c.X += el.scrollLeft ;
				c.Y += el.scrollTop  ;
				break ;
			}
		}
		else
			el = el.offsetParent ;
	}

	// Return the Coordinates object
	return c ;
}
function GetElementWindow  ( element )
{
	return GetDocumentWindow( GetElementDocument( element ) ) ;
}
function GetDocumentWindow  ( doc )
{
	// With Safari, there is not way to retrieve the window from the document, so we must fix it.
	 if ( IFBrowserInfo.IsSafari && !doc.parentWindow )
		 this.FixDocumentParentWindow( window.top ) ;
	
	return doc.parentWindow || doc.defaultView ;
}
function GetElementDocument   ( element )
{
	return element.ownerDocument || element.document ;
}
IFPanel.prototype.Hide = function( ignoreOnHide )
{
	if ( this._Popup )
		this._Popup.hide() ;
	else
	{
		if ( !this._IsOpened )
			return ;
		
		// It is better to set the sizes to 0, otherwise Firefox would have 
		// rendering problems.
		this._IFrame.width = this._IFrame.height = 0 ;

		this._IsOpened = false ;
		
		 if ( this.ParentPanel )
		 	this.ParentPanel.Unlock() ;

		 if ( !ignoreOnHide )
		 	IFTools.RunFunction( this.OnHide, this ) ;
	}
}

IFPanel.prototype.CheckIsOpened = function()
{
	if ( this._Popup )
		return this._Popup.isOpen ;
	else
		return this._IsOpened ;
}

IFPanel.prototype.CreateChildPanel = function()
{
	var oWindow = this._Popup ? IFTools.GetParentWindow( this.Document ) : this._Window ;

	var oChildPanel = new IFPanel( oWindow, true ) ;
	oChildPanel.ParentPanel = this ;
	
	return oChildPanel ;
}

IFPanel.prototype.Lock = function()
{
	this._LockCounter++ ;
}

IFPanel.prototype.Unlock = function()
{
	if ( --this._LockCounter == 0 && !this.HasFocus )
		this.Hide() ;
}

/* Events */

function IFPanel_Window_OnFocus( e, panel )
{
	panel.HasFocus = true ;
}

function IFPanel_Window_OnBlur( e, panel )
{
	panel.HasFocus = false ;
	
	 if ( panel._LockCounter == 0 )
	 	IFTools.RunFunction( panel.Hide, panel ) ;
}

function CheckPopupOnHide( forceHide )
{
	if ( forceHide || !this._Popup.isOpen )
	{
		window.clearInterval( this._Timer ) ;
		this._Timer = null ;
	
		 IFTools.RunFunction( this.OnHide, this ) ;
	}
}

function IFPanel_Cleanup()
{
	this._Popup = null ;
	this._Window = null ;
	this.Document = null ;
	this.MainNode = null ;
}
var IFTools =function()
{
}
IFTools.RunFunction = function( func, thisObject, paramsArray, timerWindow )
{
	if ( func )
		this.SetTimeout( func, 0, thisObject, paramsArray, timerWindow ) ;
}

IFTools.SetTimeout = function( func, milliseconds, thisObject, paramsArray, timerWindow )
{
	return ( timerWindow || window ).setTimeout( 
		function()
		{
			if ( paramsArray )
				func.apply( thisObject, [].concat( paramsArray ) ) ;
			else
				func.apply( thisObject ) ;
		},
		milliseconds ) ;
}
IFTools.SetInterval = function( func, milliseconds, thisObject, paramsArray, timerWindow )
{
	return ( timerWindow || window ).setInterval( 
		function()
		{
			func.apply( thisObject, paramsArray || [] ) ;
		},
		milliseconds ) ;
}
IFTools.AddEventListenerEx = function( sourceObject, eventName, listener, paramsArray )
{
	sourceObject.addEventListener( 
		eventName, 
		function( e )
		{
			listener.apply( sourceObject, [ e ].concat( paramsArray || [] ) ) ;
		},
		false 
	) ;
}
IFTools.DisableSelection = function( element )
{
	if ( IFBrowserInfo.IsGecko ) 
		element.style.MozUserSelect	= 'none' ;	// Gecko only.	
	else
		element.style.userSelect	= 'none' ;	// CSS3 (not supported yet).
}
IFTools.AppendStyleSheet = function(cssStyle, documentElement  )
{
   var doc=documentElement;
   if(doc==null)doc=window.document ;
	var e = $('ext_CSS');
	 if(e==null){
	e=window.document.createElement( 'style' ) ;
	 e.type	= 'text/css' ;
    e.id    ='ext_CSS';
    doc.getElementsByTagName("head")[0].appendChild( e ) ;
    }
    
	 if(!IFBrowserInfo.IsIE)
	  e.textContent+=cssStyle;
	  else
	  {   
 
	     e.styleSheet.cssText+=cssStyle;
	  }
	 
	return e ;
}
 var setcolors=null;
function selectColor(pal,obj)
{
  if(setcolors==null)
  setcolors=new IFColorCommand(pal,obj);
  else
  {
  curObj=setcolors.Obj=obj;
  
   curPal=setcolors.Panel=pal;
  }
  
 setcolors.Execute(1,12,obj);
}
function setBGOuterColor(color){
var v=' body {background-color:'+color+'; }';
$('OuterBodyBGColor').value=color;

setStyle(v);
}
function setBGInnerColor(color){
var v=' .mainbody {background-color:'+color+'; }';
$('InnerBodyBGColor').value=color;
setStyle(v);
}
function setPageBGImg(url){if(url.trim()!='')IFTools.AppendStyleSheet(' .mainbody{background-image:url('+url+');}', window.document);}
function setPageOutBGImg(url){if(url.trim()!='')IFTools.AppendStyleSheet('body{background-image:url('+url+');}', window.document);}
  var curstyle='';
 function setpartborder(style)
{if(curstyle!=style){curstyle=style;
IFTools.AppendStyleSheet('.OpaquePartMain, .PicTab, .BottomPanel, .partsmb{border-style:'+style+';}', window.document);
 $('ModuleBorderStyle').value=style;
}
}
function setbordercolor(color)
 {
 IFTools.AppendStyleSheet('.OpaquePartMain, .PicTab, .BottomPanel, .partsmb,.bordercolor{border-color:'+color+';}', window.document); }
function selborderwidth(width){
IFTools.AppendStyleSheet('.OpaquePartMain, .PicTab, .BottomPanel, .partsmb{border-width:'+width+'px;}', window.document);
 }
 function setlnkColor(color)
 {
 IFTools.AppendStyleSheet('.OpaquePartMain A, .PicTab A, .BottomPanel A, .partsmb A{color:'+color+';}', window.document);
 
     $('LnkColor').value=color;                                                                                       
 }
 function setfontColor(color)
 {
 var v;
 v='.OpaquePartMain  , .PicTab , .BottomPanel  , .partsmb {color:'+color+';}';
  $('FontColor').value=color;   
  setStyle(v);                                                                                  
 } 
 function setImageTrans(BGImageTrans)
{ 
 var v='xiaoxiao\\:part,.OpaquePartMain, .PicTab, .BottomPanel, .partsmb{FILTER: progid:DXImageTransform.Microsoft.Alpha(opacity=' + BGImageTrans + ');-moz-opacity:'+(BGImageTrans/100)+'}';
  setStyle(v);
  } 
  function sethdHeight(height)
  {
    if(height>600)height=600;
   if(height>0 ){
   var  v='.shdrbg, #pagehead{height:'+height+'px; }'
   setStyle(v);
   }
  }
  function sethdColor(color)
  {
  var  v='.shdrbg, .spudbody{background-color:'+color+'; }'
  setStyle(v);
  }
   function setpartbgcolor(color)
  {
   IFTools.AppendStyleSheet('.OpaquePartMain  , .PicTab , .BottomPanel  , .partsmb {background-color:'+color+';}', window.document);
  } 
  function setBGImagePosition(pos)
  {
   var v='.mainbody{background-position:'+pos+'}';
   setStyle(v);
  }  
  function setBGImageRepeat(ret)
  {
   var v='.mainbody{background-repeat:'+ret+'}';
   setStyle(v);
  }
  function setBGImageDisplay(chk)
  {
  var dis=chk.checked?'hide':'default';
  if(chk.checked)
  {
  chk.value=1;
  $('BGImageRepeat').disabled=true;
   $('BGImagePosition').disabled=true;
    $('iptbgurl').disabled=true;
  }else
  {chk.value=0;
   $('BGImageRepeat').disabled=false;
   $('BGImagePosition').disabled=false;
    $('iptbgurl').disabled=false;
  }
  var v='.mainbody{display:'+dis+'}';
   if(chk)
  setStyle(v);
  }
  function setPartBGImg(imgurl)
  {
  if(!imgurl&&imgurl.trim()=='')return;
   var v='.OpaquePartMain  , .PicTab , .BottomPanel  , .partsmb {background-image:url('+imgurl+');}';
   setStyle(v);
  }
  function hidephader(v)
  {v.value=v.checked?1:0;
   if(v.checked)
      setStyle('.pheader{display:none;}');
     else
      setStyle('.pheader{display:block;}');
  }
  function sethdBGImg(imgurl)
  {if(!imgurl&&imgurl.trim()=='')return;
    var v='.shdrbg {background-image:url('+imgurl+');}';
   setStyle(v);
  }
  function sethdBGImagePosition(pos)
  {
   var v='.shdrbg{background-position:'+pos+'}';
   setStyle(v);
  }  
   function sethdBGImageRepeat(ret)
  {
  
   var v='.shdrbg{background-repeat:'+ret+'}';
   setStyle(v);
  }
  function sethdBGImageDisplay(chk)
  {
  var dis=chk.checked?'hide':'default';
  if(chk.checked)
  {chk.value=1;
  $('hdBGImageRepeat').disabled=true;
   $('hdBGImagePosition').disabled=true;
    $('ipthdbgimg').disabled=true;
    var v='.shdrbg {background-image:none}';
   setStyle(v);
  }else
  {chk.value=0;
   $('hdBGImageRepeat').disabled=false;
   $('hdBGImagePosition').disabled=false;
    $('ipthdbgimg').disabled=false;
 
  }
  }
 function setStyle(v)
 {
 IFTools.AppendStyleSheet(v, window.document);
 }
 function myExtStyle()   
 {
  var v=$('ExtCSS');
  if(v==null)return;
  if(v.style.display=='none')
  v.style.display='';
  else
  v.style.display='none';
 } 
 function chkLength(i1,i2) 
 {
  if(i1>i2)
   _error_msg_show('最多只充许'+i2+'个字符,您超过了'+(i2-i1)+'个');
 }  
 function displayFav()
 {
 var v=$('favpanel');
  if(v.style.display=='none')
  v.style.display='';
  else
  v.style.display='none';
 }                                                                  