/**
 * SWFObject v1.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formarly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){
if(!document.createElement||!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute("version"),_7);
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){
_16.push(key+"="+_18[key]);}
return _16;
},getSWFHTML:function(){
var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}
_19+="/>";
}else{
if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}
_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();
return true;
}else{
if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(_23,_24){
var _25=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_25=new deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{
var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
for(var i=3;axo!=null;i++){
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
_25=new deconcept.PlayerVersion([i,0,0]);}}
catch(e){}
if(_23&&_25.major>_23.major){return _25;}
if(!_23||((_23.minor!=0||_23.rev!=0)&&_25.major==_23.major)||_25.major!=6||_24){
try{_25=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}
catch(e){}}}
return _25;};
deconcept.PlayerVersion=function(_29){
this.major=parseInt(_29[0])!=null?parseInt(_29[0]):0;
this.minor=parseInt(_29[1])||0;
this.rev=parseInt(_29[2])||0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){return false;}return true;};
deconcept.util={getRequestParameter:function(_2b){
var q=document.location.search||document.location.hash;
if(q){
var _2d=q.indexOf(_2b+"=");
var _2e=(q.indexOf("&",_2d)>-1)?q.indexOf("&",_2d):q.length;
if(q.length>1&&_2d>-1){
return q.substring(q.indexOf("=",_2d)+1,_2e);
}}return "";}};
if(Array.prototype.push==null){
Array.prototype.push=function(_2f){
this[this.length]=_2f;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject; // for backwards compatibility
var SWFObject=deconcept.SWFObject;

/**
 * SWFFormFix v2.1.0: SWF ExternalInterface() Form Fix - http://http://www.teratechnologies.net/stevekamerman/
 *
 * SWFFormFix is (c) 2007 Steve Kamerman and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Project sponsored by Tera Technologies - http://www.teratechnologies.net/
 */
////////////////////////////////////////////////////
////////////  Configurable options  ////////////////
////////////////////////////////////////////////////
var EnableFullAuto	= true; // set this to true and all of your flash objects will be fixed automatically
var SWFFormFixDebug = false; // set this to true to be alerted whenever a flash object is found and fixed
var NotLoadedWarning = true; // set this to true to alert the users when they try to access a function from
							 // the ExternalInterface() that isn't loaded yet
var NotLoadedMsg = "Please wait for the page to load..."; // this is the warning they will see
////////////////////////////////////////////////////
//////////  END Configurable options  //////////////
////////////////////////////////////////////////////
/**
 * Usage:
 * ------------------------------------------------------------
 * There are three ways to use SWFFormFix, FULL AUTO, Auto and Manual mode.
 * To use either method you need to include this file in the 
 * HEAD section of your page like this: 

<script src="swfformfix.js" type="text/javascript"></script>

 * 
 * NOTE: If you want Javascript to call Flash, you need to make
 * a dummy object like follows:
 
window["myFlashObject"] = new Object();

 * Put this line directly above your call to SWFObject().
 * Replace "myFlashObject" with the ID of your object (the 2nd
 * parameter you give to SWFObject() ).  This will prevent your
 * page from dieing with an error like "myFlashObject is undefined".
 * 
 * --> FULL AUTO Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them as the page loads.
 * It will poll the page for all the objects and determine if it
 * needs to apply the fix to them every 100ms until the page is
 * completely loaded.  All you need to do to use this mode is
 * include the script in the head of your document and set the
 * "EnableFullAuto" directive to true at the top of the script.
 *
 * --> Auto Mode:
 * This will attempt to find every Flash Movie that you have on
 * the page and apply the fix to each of them.  To use auto mode
 * put the following code before the </body> tag. More specifically
 * it needs to be AFTER your last Flash object.

<script type="text/javascript">
// <![CDATA[
	SWFFormFixAuto();
// ]]>
</script>

 * 
 * --> Manual Mode:
 * This lets you fix just a single Flash object if you don't want
 * the auto mode to try to fix every Flash object on the page.
 * This mode is faster than the auto mode and may work better in
 * some situations.  To use manual mode put the following code
 * after the Flash object you want to fix, where "myFlashObject"
 * is the ID of the Flash Object:

Example for normal EMBED style:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="200" height="100" id="myFlashObject" align="middle">
<param name="movie" value="myMovie.swf" />
<param name="quality" value="high" />
<embed src="myMovie.swf" quality="high" width="200" height="100" name="myFlashObject" type="application/x-shockwave-flash" />
</object>

<script type="text/javascript">
// <![CDATA[
SWFFormFix("myMovieObjectName");
// ]]>
</script>

Example for SWFObject style:

<div id="flashcontent" style="width:200px;height:100px;">This is replaced by the Flash movie.</div>
<script type="text/javascript">
// <![CDATA[
// Please note that the ID that you need to use for SWFFormFix() is the second argument in SWFObject().
var so = new SWFObject("myMovie.swf", "myFlashObject","200", "100", "6.0.0", "#ffffff");
so.addParam("quality", "high");
so.write("flashcontent");
SWFFormFix("myFlashObject");
// ]]>
</script>

 * 
 * Changelog:
 * ------------------------------------------------------------
 * v2.1
 *   Fixed IE cache bug that prevents JS -> Flash after refresh.  Now SWFFormFix
 *   rebuilds all the ExternalInterface() methods that were inadvertently destroyed.
 * v2.0
 *   Added FULL AUTO mode - just enable it below and include the script!
 *   Special thanks to Geoff Stearns from deconcept and onDOMload by Aaron Barker
 * 
 * v1.0
 *   Added the SWFFormFixAuto() function, very well optimized and fast.
 * 
 * v0.2
 *   Changed helper element from <input> element to hidden <div> element
 *
 * v0.1
 *   Initial release.
 */

finished = false; // this is set to true when the body's onload is called, to stop the script
timeout = 10; // seconds to wait before giving up
starttime = new Date().getTime();
flashObjectList = Array();
fixedList = Array();
makeFuncArr = Array();
SWFFormFixAuto2 = function(){
//alert("running...");
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return true;
	var flashObjectList = document.getElementsByTagName("object");
	for(var i=0;i<flashObjectList.length;i++){
		var obj = flashObjectList[i];
		// here's all the objects on the page, now lets find the flash objects
		if(obj.getAttribute('classid') == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			var id = obj.getAttribute('id');
			var alreadyfixed = false;
			for(var c=0;c<fixedList.length;c++){if(fixedList[i] == id)alreadyfixed=true;}
			// this is a flash movie, apply the fix (unless it's already been fixed)
			if(!alreadyfixed){
				var debugtxt = '';
				for(var b in window[id]){
					// ExternalInterface() tried to add some functions to the incorrect object
					if(typeof(window[id][b])=="function"){
						// this function will need to be rebuilt when the page is done loading.
						makeFuncArr.push(Array(obj,b));
						obj[b] = function(){
							if(NotLoadedWarning)alert(NotLoadedMsg);
							return("");
						}
/*
 * it seems like this would work to copy the function, but it doesn't:
 *
 * eval('obj[b]='+window[id][b].toString());
 * 
 * This is the actual function that we're trying to copy:

function () { 
  return eval(instance.CallFunction("<invoke name=\""+name+"\" returntype=\"javascript\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));
}

 * it will fail if you copy it to the new object though because "instance" and "name" are undefined
 * Here's how to see the actual function def: document.getElementById("txt_debug").value=window[id][b];
 */
					}
				}
				window[id]=obj;
				if(SWFFormFixDebug)alert("Fixed: "+id);
			}
		}
	}
	if(!finished){
		setTimeout("SWFFormFixAuto2()", 100);
	}else{
		for(var i=0;i<makeFuncArr.length;i++){
			// this is executed after the page is loaded - it rebuilds the custom
			// ExternalInterface() functions
			SWFFormFix_rebuildExtFunc(makeFuncArr[i][0],makeFuncArr[i][1]);
		}
	}
	return true;
}
SWFFormFix_rebuildExtFunc = function(obj,functionName){
	eval('obj[functionName] = function(){return eval(this.CallFunction("<invoke name=\\"'+functionName+'\\" returntype=\\"javascript\\">" + __flash__argumentsToXML(arguments,0) + "</invoke>"));}');
	if(SWFFormFixDebug)alert("Rebuilt ExternalInterface() function: "+functionName);
}
SWFFormFixOnloadAppend = function() {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = function(){
			finished=true;
		}
	} else {
		window.onload = function() {
			oldonload();
			finished=true;
		}
	}
}
SWFFormFixAuto = function(){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return true;
	var objects = document.getElementsByTagName("object");
	if(objects.length == 0) return true;
	for(i=0;i<objects.length;i++){
		// here's all the objects on the page, now lets find the flash objects
		if(objects[i].classid == "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"){
			// this is a flash movie, apply the fix
			window[objects[i].id] = objects[i];
		}
	}
	var out = "";
	return true;
}
SWFFormFix = function(swfname){
	if(navigator.appName.toLowerCase() != "microsoft internet explorer")return false;
	var testnodename = "SWFFormFixTESTER";
	document.write('<div id="'+testnodename+'" onclick="SWFFormFixCallback(this,\''+swfname+'\');return false;" style="display:none">&nbsp;</div>');
	document.getElementById(testnodename).onclick();
}
SWFFormFixCallback = function (obj,swfname){
	var path = document;
	var error = false;
	var testnode = obj;
	while(obj = obj.parentNode){
		if(obj.nodeName.toLowerCase() == "form"){
			if(obj.name != undefined && obj.name != null && obj.name.length > 0){
				path = path.forms[obj.name];
			}else{
				alert("Error: one of your forms does not have a name!");
				error = true;
			}
		}
	}
	testnode.parentNode.removeChild(testnode);
	if(error) return false;
	window[swfname]=path[swfname];
	return true;
}
function noCacheIE(url){
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	if(!isIE)return(url);
	var newUrl = '?';
	if(url.indexOf('?') != -1)newUrl = '&';
	var now = new Date();
	var rand = Math.random().toString().substring(2,4);
	newUrl = url+newUrl+"noCacheIE="+rand+'-'+now.getTime().toString();
	return(newUrl);
}
if(EnableFullAuto){
	SWFFormFixAuto2();
	SWFFormFixOnloadAppend();
}// Flash Player Version Detection - Rev 1.5
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;			
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
			var versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


//Code block from HPFlex.ascx
    function DetectFlash()
    {
    // -----------------------------------------------------------------------------
    // Globals
    // Major version of Flash required
    var requiredMajorVersion = 9;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;
    // -----------------------------------------------------------------------------
    // -->
    

    
        var hasProductInstall = DetectFlashVer(6, 0, 65);

       
        var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);


        // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
        if ( hasProductInstall && !hasRequestedVersion ) {
            // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
            // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
            // DO NOT MODIFY THE FOLLOWING FOUR LINES
            // Location visited after installation is complete if installation is required
            
            var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
            var MMredirectURL = window.location;
            document.title = document.title.slice(0, 47) + " - Flash Player Installation";
            var MMdoctitle = document.title;

            window["ppng_product_swf"] = new Object();
            var so = new SWFObject("/swf/ppng_product_swf.swf", "ppng_product_swf", "1000", "270", "9" ,"#ffffff");
            so.addParam("scale", "noscale");
            so.write("ppngHomeFlex");
            
        } else if (hasRequestedVersion) {
            // if we've detected an acceptable version
            // embed the Flash Content SWF when all tests are passed
               
            window["ppng_product_swf"] = new Object();
            var so = new SWFObject("/swf/ppng_product_swf.swf", "ppng_product_swf", "1000", "270", "9" ,"#ffffff");
            so.addParam("scale", "noscale");
            so.write("ppngHomeFlex");
        } else {  // flash is too old or we can't detect the plugin
            var alternateContent = 'PPG Quick catalog : '
            + 'This content requires the Adobe Flash Player. '
            + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
            document.write(alternateContent);  // insert non-flash content
        }
        }// $Revision: 1.49 $
// Vars
Vars = function(qStr) {
	this.numVars = 0;
	if(qStr != null) {
		var nameValue, name;
		var pairs = qStr.split('&');
		var pairLen = pairs.length;
		for(var i = 0; i < pairLen; i++) {
			var pair = pairs[i];
			if( (pair.indexOf('=')!= -1) && (pair.length > 3) ) {
				var nameValue = pair.split('=');
				var name = nameValue[0];
				var value = nameValue[1];
				if(this[name] == null && name.length > 0 && value.length > 0) { 
					this[name] = value;
					this.numVars++;
				}
			}
		} 
	}
}
Vars.prototype.toString = function(pre) {
	var result = '';
	if(pre == null) { pre = ''; }
	for(var i in this) {
		if(this[i] != null && typeof(this[i]) != 'object' && typeof(this[i]) != 'function' && i != 'numVars') {
			result += pre + i + '=' + this[i] + '&';
		}
	}
	if(result.length > 0) result = result.substr(0, result.length-1);
	return result;
}
function getSearch(wRef) {
	var searchStr = '';
	if(wRef.location.search.length > 1) {
		searchStr = new String(wRef.location.search);
		searchStr = searchStr.substring(1, searchStr.length);
	}
	return searchStr;
}
var lc_id = Math.floor(Math.random() * 100000).toString(16);
if (this != top)
{
	top.Vars = Vars;
	top.getSearch = getSearch;
	top.lc_id = lc_id;
}

if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{isArray:function(B){if(B){var A=YAHOO.lang;return A.isNumber(B.length)&&A.isFunction(B.splice);}return false;},isBoolean:function(A){return typeof A==="boolean";},isFunction:function(A){return typeof A==="function";},isNull:function(A){return A===null;},isNumber:function(A){return typeof A==="number"&&isFinite(A);},isObject:function(A){return(A&&(typeof A==="object"||YAHOO.lang.isFunction(A)))||false;},isString:function(A){return typeof A==="string";},isUndefined:function(A){return typeof A==="undefined";},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B);}return!YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B];},_IEEnumFix:function(C,B){if(YAHOO.env.ua.ie){var E=["toString","valueOf"],A;for(A=0;A<E.length;A=A+1){var F=E[A],D=B[F];if(YAHOO.lang.isFunction(D)&&D!=Object.prototype[F]){C[F]=D;}}}},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E;}if(C){for(var A in C){D.prototype[A]=C[A];}YAHOO.lang._IEEnumFix(D.prototype,C);}},augmentObject:function(E,D){if(!D||!E){throw new Error("Absorb failed, verify dependencies.");}var A=arguments,C,F,B=A[2];if(B&&B!==true){for(C=2;C<A.length;C=C+1){E[A[C]]=D[A[C]];}}else{for(F in D){if(B||!E[F]){E[F]=D[F];}}YAHOO.lang._IEEnumFix(E,D);}},augmentProto:function(D,C){if(!C||!D){throw new Error("Augment failed, verify dependencies.");}var A=[D.prototype,C.prototype];for(var B=2;B<arguments.length;B=B+1){A.push(arguments[B]);}YAHOO.lang.augmentObject.apply(this,A);},dump:function(A,G){var C=YAHOO.lang,D,F,I=[],J="{...}",B="f(){...}",H=", ",E=" => ";if(!C.isObject(A)){return A+"";}else{if(A instanceof Date||("nodeType"in A&&"tagName"in A)){return A;}else{if(C.isFunction(A)){return B;}}}G=(C.isNumber(G))?G:3;if(C.isArray(A)){I.push("[");for(D=0,F=A.length;D<F;D=D+1){if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}if(I.length>1){I.pop();}I.push("]");}else{I.push("{");for(D in A){if(C.hasOwnProperty(A,D)){I.push(D+E);if(C.isObject(A[D])){I.push((G>0)?C.dump(A[D],G-1):J);}else{I.push(A[D]);}I.push(H);}}if(I.length>1){I.pop();}I.push("}");}return I.join("");},substitute:function(Q,B,J){var G,F,E,M,N,P,D=YAHOO.lang,L=[],C,H="dump",K=" ",A="{",O="}";for(;;){G=Q.lastIndexOf(A);if(G<0){break;}F=Q.indexOf(O,G);if(G+1>=F){break;}C=Q.substring(G+1,F);M=C;P=null;E=M.indexOf(K);if(E>-1){P=M.substring(E+1);M=M.substring(0,E);}N=B[M];if(J){N=J(M,N,P);}if(D.isObject(N)){if(D.isArray(N)){N=D.dump(N,parseInt(P,10));}else{P=P||"";var I=P.indexOf(H);if(I>-1){P=P.substring(4);}if(N.toString===Object.prototype.toString||I>-1){N=D.dump(N,parseInt(P,10));}else{N=N.toString();}}}else{if(!D.isString(N)&&!D.isNumber(N)){N="~-"+L.length+"-~";L[L.length]=C;}}Q=Q.substring(0,G)+N+Q.substring(F+1);}for(G=L.length-1;G>=0;G=G-1){Q=Q.replace(new RegExp("~-"+G+"-~"),"{"+L[G]+"}","g");}return Q;},trim:function(A){try{return A.replace(/^\s+|\s+$/g,"");}catch(B){return A;}},merge:function(){var D={},B=arguments;for(var C=0,A=B.length;C<A;C=C+1){YAHOO.lang.augmentObject(D,B[C],true);}return D;},later:function(H,B,I,D,E){H=H||0;B=B||{};var C=I,G=D,F,A;if(YAHOO.lang.isString(I)){C=B[I];}if(!C){throw new TypeError("method undefined");}if(!YAHOO.lang.isArray(G)){G=[D];}F=function(){C.apply(B,G);};A=(E)?setInterval(F,H):setTimeout(F,H);return{interval:E,cancel:function(){if(this.interval){clearInterval(A);}else{clearTimeout(A);}}};},isValue:function(B){var A=YAHOO.lang;return(A.isObject(B)||A.isString(B)||A.isNumber(B)||A.isBoolean(B));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.5.1",build:"984"});(function(){var B=YAHOO.util,K,I,J={},F={},M=window.document;YAHOO.env._id_counter=YAHOO.env._id_counter||0;var C=YAHOO.env.ua.opera,L=YAHOO.env.ua.webkit,A=YAHOO.env.ua.gecko,G=YAHOO.env.ua.ie;var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i,OP_SCROLL:/^(?:inline|table-row)$/i};var N=function(P){if(!E.HYPHEN.test(P)){return P;}if(J[P]){return J[P];}var Q=P;while(E.HYPHEN.exec(Q)){Q=Q.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());}J[P]=Q;return Q;};var O=function(Q){var P=F[Q];if(!P){P=new RegExp("(?:^|\\s+)"+Q+"(?:\\s+|$)");F[Q]=P;}return P;};if(M.defaultView&&M.defaultView.getComputedStyle){K=function(P,S){var R=null;if(S=="float"){S="cssFloat";}var Q=P.ownerDocument.defaultView.getComputedStyle(P,"");if(Q){R=Q[N(S)];}return P.style[S]||R;};}else{if(M.documentElement.currentStyle&&G){K=function(P,R){switch(N(R)){case"opacity":var T=100;try{T=P.filters["DXImageTransform.Microsoft.Alpha"].opacity;}catch(S){try{T=P.filters("alpha").opacity;}catch(S){}}return T/100;case"float":R="styleFloat";default:var Q=P.currentStyle?P.currentStyle[R]:null;return(P.style[R]||Q);}};}else{K=function(P,Q){return P.style[Q];};}}if(G){I=function(P,Q,R){switch(Q){case"opacity":if(YAHOO.lang.isString(P.style.filter)){P.style.filter="alpha(opacity="+R*100+")";if(!P.currentStyle||!P.currentStyle.hasLayout){P.style.zoom=1;}}break;case"float":Q="styleFloat";default:P.style[Q]=R;}};}else{I=function(P,Q,R){if(Q=="float"){Q="cssFloat";}P.style[Q]=R;};}var D=function(P,Q){return P&&P.nodeType==1&&(!Q||Q(P));};YAHOO.util.Dom={get:function(R){if(R&&(R.nodeType||R.item)){return R;}if(YAHOO.lang.isString(R)||!R){return M.getElementById(R);}if(R.length!==undefined){var S=[];for(var Q=0,P=R.length;Q<P;++Q){S[S.length]=B.Dom.get(R[Q]);}return S;}return R;},getStyle:function(P,R){R=N(R);var Q=function(S){return K(S,R);};return B.Dom.batch(P,Q,B.Dom,true);},setStyle:function(P,R,S){R=N(R);var Q=function(T){I(T,R,S);};B.Dom.batch(P,Q,B.Dom,true);},getXY:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=R.ownerDocument.body){return false;}return H(R);};return B.Dom.batch(P,Q,B.Dom,true);},getX:function(P){var Q=function(R){return B.Dom.getXY(R)[0];};return B.Dom.batch(P,Q,B.Dom,true);},getY:function(P){var Q=function(R){return B.Dom.getXY(R)[1];};return B.Dom.batch(P,Q,B.Dom,true);},setXY:function(P,S,R){var Q=function(V){var U=this.getStyle(V,"position");if(U=="static"){this.setStyle(V,"position","relative");U="relative";}var X=this.getXY(V);if(X===false){return false;}var W=[parseInt(this.getStyle(V,"left"),10),parseInt(this.getStyle(V,"top"),10)];if(isNaN(W[0])){W[0]=(U=="relative")?0:V.offsetLeft;}if(isNaN(W[1])){W[1]=(U=="relative")?0:V.offsetTop;}if(S[0]!==null){V.style.left=S[0]-X[0]+W[0]+"px";}if(S[1]!==null){V.style.top=S[1]-X[1]+W[1]+"px";}if(!R){var T=this.getXY(V);if((S[0]!==null&&T[0]!=S[0])||(S[1]!==null&&T[1]!=S[1])){this.setXY(V,S,true);}}};B.Dom.batch(P,Q,B.Dom,true);},setX:function(Q,P){B.Dom.setXY(Q,[P,null]);},setY:function(P,Q){B.Dom.setXY(P,[null,Q]);},getRegion:function(P){var Q=function(R){if((R.parentNode===null||R.offsetParent===null||this.getStyle(R,"display")=="none")&&R!=R.ownerDocument.body){return false;}var S=B.Region.getRegion(R);return S;};return B.Dom.batch(P,Q,B.Dom,true);},getClientWidth:function(){return B.Dom.getViewportWidth();},getClientHeight:function(){return B.Dom.getViewportHeight();},getElementsByClassName:function(T,X,U,V){X=X||"*";U=(U)?B.Dom.get(U):null||M;if(!U){return[];}var Q=[],P=U.getElementsByTagName(X),W=O(T);for(var R=0,S=P.length;R<S;++R){if(W.test(P[R].className)){Q[Q.length]=P[R];if(V){V.call(P[R],P[R]);}}}return Q;},hasClass:function(R,Q){var P=O(Q);var S=function(T){return P.test(T.className);};return B.Dom.batch(R,S,B.Dom,true);},addClass:function(Q,P){var R=function(S){if(this.hasClass(S,P)){return false;}S.className=YAHOO.lang.trim([S.className,P].join(" "));return true;};return B.Dom.batch(Q,R,B.Dom,true);},removeClass:function(R,Q){var P=O(Q);var S=function(T){if(!Q||!this.hasClass(T,Q)){return false;}var U=T.className;T.className=U.replace(P," ");if(this.hasClass(T,Q)){this.removeClass(T,Q);}T.className=YAHOO.lang.trim(T.className);return true;};return B.Dom.batch(R,S,B.Dom,true);},replaceClass:function(S,Q,P){if(!P||Q===P){return false;}var R=O(Q);var T=function(U){if(!this.hasClass(U,Q)){this.addClass(U,P);return true;}U.className=U.className.replace(R," "+P+" ");if(this.hasClass(U,Q)){this.replaceClass(U,Q,P);}U.className=YAHOO.lang.trim(U.className);return true;};return B.Dom.batch(S,T,B.Dom,true);},generateId:function(P,R){R=R||"yui-gen";var Q=function(S){if(S&&S.id){return S.id;}var T=R+YAHOO.env._id_counter++;if(S){S.id=T;}return T;};return B.Dom.batch(P,Q,B.Dom,true)||Q.apply(B.Dom,arguments);},isAncestor:function(P,Q){P=B.Dom.get(P);Q=B.Dom.get(Q);if(!P||!Q){return false;}if(P.contains&&Q.nodeType&&!L){return P.contains(Q);}else{if(P.compareDocumentPosition&&Q.nodeType){return!!(P.compareDocumentPosition(Q)&16);}else{if(Q.nodeType){return!!this.getAncestorBy(Q,function(R){return R==P;});}}}return false;},inDocument:function(P){return this.isAncestor(M.documentElement,P);},getElementsBy:function(W,Q,R,T){Q=Q||"*";R=(R)?B.Dom.get(R):null||M;if(!R){return[];}var S=[],V=R.getElementsByTagName(Q);for(var U=0,P=V.length;U<P;++U){if(W(V[U])){S[S.length]=V[U];if(T){T(V[U]);}}}return S;},batch:function(T,W,V,R){T=(T&&(T.tagName||T.item))?T:B.Dom.get(T);if(!T||!W){return false;}var S=(R)?V:window;if(T.tagName||T.length===undefined){return W.call(S,T,V);}var U=[];for(var Q=0,P=T.length;Q<P;++Q){U[U.length]=W.call(S,T[Q],V);}return U;},getDocumentHeight:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollHeight:M.documentElement.scrollHeight;var P=Math.max(Q,B.Dom.getViewportHeight());return P;},getDocumentWidth:function(){var Q=(M.compatMode!="CSS1Compat")?M.body.scrollWidth:M.documentElement.scrollWidth;var P=Math.max(Q,B.Dom.getViewportWidth());return P;},getViewportHeight:function(){var P=self.innerHeight;
var Q=M.compatMode;if((Q||G)&&!C){P=(Q=="CSS1Compat")?M.documentElement.clientHeight:M.body.clientHeight;}return P;},getViewportWidth:function(){var P=self.innerWidth;var Q=M.compatMode;if(Q||G){P=(Q=="CSS1Compat")?M.documentElement.clientWidth:M.body.clientWidth;}return P;},getAncestorBy:function(P,Q){while(P=P.parentNode){if(D(P,Q)){return P;}}return null;},getAncestorByClassName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return B.Dom.hasClass(S,P);};return B.Dom.getAncestorBy(Q,R);},getAncestorByTagName:function(Q,P){Q=B.Dom.get(Q);if(!Q){return null;}var R=function(S){return S.tagName&&S.tagName.toUpperCase()==P.toUpperCase();};return B.Dom.getAncestorBy(Q,R);},getPreviousSiblingBy:function(P,Q){while(P){P=P.previousSibling;if(D(P,Q)){return P;}}return null;},getPreviousSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getPreviousSiblingBy(P);},getNextSiblingBy:function(P,Q){while(P){P=P.nextSibling;if(D(P,Q)){return P;}}return null;},getNextSibling:function(P){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getNextSiblingBy(P);},getFirstChildBy:function(P,R){var Q=(D(P.firstChild,R))?P.firstChild:null;return Q||B.Dom.getNextSiblingBy(P.firstChild,R);},getFirstChild:function(P,Q){P=B.Dom.get(P);if(!P){return null;}return B.Dom.getFirstChildBy(P);},getLastChildBy:function(P,R){if(!P){return null;}var Q=(D(P.lastChild,R))?P.lastChild:null;return Q||B.Dom.getPreviousSiblingBy(P.lastChild,R);},getLastChild:function(P){P=B.Dom.get(P);return B.Dom.getLastChildBy(P);},getChildrenBy:function(Q,S){var R=B.Dom.getFirstChildBy(Q,S);var P=R?[R]:[];B.Dom.getNextSiblingBy(R,function(T){if(!S||S(T)){P[P.length]=T;}return false;});return P;},getChildren:function(P){P=B.Dom.get(P);if(!P){}return B.Dom.getChildrenBy(P);},getDocumentScrollLeft:function(P){P=P||M;return Math.max(P.documentElement.scrollLeft,P.body.scrollLeft);},getDocumentScrollTop:function(P){P=P||M;return Math.max(P.documentElement.scrollTop,P.body.scrollTop);},insertBefore:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}return P.parentNode.insertBefore(Q,P);},insertAfter:function(Q,P){Q=B.Dom.get(Q);P=B.Dom.get(P);if(!Q||!P||!P.parentNode){return null;}if(P.nextSibling){return P.parentNode.insertBefore(Q,P.nextSibling);}else{return P.parentNode.appendChild(Q);}},getClientRegion:function(){var R=B.Dom.getDocumentScrollTop(),Q=B.Dom.getDocumentScrollLeft(),S=B.Dom.getViewportWidth()+Q,P=B.Dom.getViewportHeight()+R;return new B.Region(R,S,P,Q);}};var H=function(){if(M.documentElement.getBoundingClientRect){return function(Q){var R=Q.getBoundingClientRect();var P=Q.ownerDocument;return[R.left+B.Dom.getDocumentScrollLeft(P),R.top+B.Dom.getDocumentScrollTop(P)];};}else{return function(R){var S=[R.offsetLeft,R.offsetTop];var Q=R.offsetParent;var P=(L&&B.Dom.getStyle(R,"position")=="absolute"&&R.offsetParent==R.ownerDocument.body);if(Q!=R){while(Q){S[0]+=Q.offsetLeft;S[1]+=Q.offsetTop;if(!P&&L&&B.Dom.getStyle(Q,"position")=="absolute"){P=true;}Q=Q.offsetParent;}}if(P){S[0]-=R.ownerDocument.body.offsetLeft;S[1]-=R.ownerDocument.body.offsetTop;}Q=R.parentNode;while(Q.tagName&&!E.ROOT_TAG.test(Q.tagName)){if(Q.scrollTop||Q.scrollLeft){if(!E.OP_SCROLL.test(B.Dom.getStyle(Q,"display"))){if(!C||B.Dom.getStyle(Q,"overflow")!=="visible"){S[0]-=Q.scrollLeft;S[1]-=Q.scrollTop;}}}Q=Q.parentNode;}return S;};}}();})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B;};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B);}else{return null;}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B);};YAHOO.util.Point=function(A,B){if(YAHOO.lang.isArray(A)){B=A[1];A=A[0];}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.5.1",build:"984"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){var D=this.subscribers.length;if(!D&&this.silent){return true;}var H=[].slice.call(arguments,0),F=true,C,I=false;if(!this.silent){}var B=this.subscribers.slice();for(C=0;C<D;++C){var K=B[C];if(!K){I=true;}else{if(!this.silent){}var J=K.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var A=null;if(H.length>0){A=H[0];}try{F=K.fn.call(J,A,K.obj);}catch(E){this.lastError=E;}}else{try{F=K.fn.call(J,this.type,H,K.obj);}catch(G){this.lastError=G;}}if(false===F){if(!this.silent){}return false;}}}return true;},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,startInterval:function(){if(!this._interval){var K=this;var L=function(){K._tryPreloadAttach();};this._interval=setInterval(L,this.POLL_INTERVAL);}},onAvailable:function(P,M,Q,O,N){var K=(YAHOO.lang.isString(P))?[P]:P;for(var L=0;L<K.length;L=L+1){F.push({id:K[L],fn:M,obj:Q,override:O,checkReady:N});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(M,K,N,L){this.onAvailable(M,K,N,L,true);},onDOMReady:function(K,M,L){if(this.DOMReady){setTimeout(function(){var N=window;if(L){if(L===true){N=M;}else{N=L;}}K.call(N,"DOMReady",[],M);},0);}else{this.DOMReadyEvent.subscribe(K,M,L);}},addListener:function(M,K,V,Q,L){if(!V||!V.call){return false;}if(this._isValidCollection(M)){var W=true;for(var R=0,T=M.length;R<T;++R){W=this.on(M[R],K,V,Q,L)&&W;}return W;}else{if(YAHOO.lang.isString(M)){var P=this.getEl(M);if(P){M=P;}else{this.onAvailable(M,function(){YAHOO.util.Event.on(M,K,V,Q,L);});return true;}}}if(!M){return false;}if("unload"==K&&Q!==this){J[J.length]=[M,K,V,Q,L];return true;}var Y=M;if(L){if(L===true){Y=Q;}else{Y=L;}}var N=function(Z){return V.call(Y,YAHOO.util.Event.getEvent(Z,M),Q);};var X=[M,K,V,N,Y,Q,L];var S=I.length;I[S]=X;if(this.useLegacyEvent(M,K)){var O=this.getLegacyIndex(M,K);if(O==-1||M!=G[O][0]){O=G.length;B[M.id+K]=O;G[O]=[M,K,M["on"+K]];E[O]=[];M["on"+K]=function(Z){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(Z),O);};}E[O].push(X);}else{try{this._simpleAdd(M,K,N,false);}catch(U){this.lastError=U;this.removeListener(M,K,V);return false;}}return true;},fireLegacyEvent:function(O,M){var Q=true,K,S,R,T,P;S=E[M].slice();for(var L=0,N=S.length;L<N;++L){R=S[L];if(R&&R[this.WFN]){T=R[this.ADJ_SCOPE];P=R[this.WFN].call(T,O);Q=(Q&&P);}}K=G[M];if(K&&K[2]){K[2](O);}return Q;},getLegacyIndex:function(L,M){var K=this.generateId(L)+M;if(typeof B[K]=="undefined"){return-1;}else{return B[K];}},useLegacyEvent:function(L,M){if(this.webkit&&("click"==M||"dblclick"==M)){var K=parseInt(this.webkit,10);if(!isNaN(K)&&K<418){return true;}}return false;},removeListener:function(L,K,T){var O,R,V;if(typeof L=="string"){L=this.getEl(L);}else{if(this._isValidCollection(L)){var U=true;for(O=L.length-1;O>-1;O--){U=(this.removeListener(L[O],K,T)&&U);}return U;}}if(!T||!T.call){return this.purgeElement(L,false,K);}if("unload"==K){for(O=J.length-1;O>-1;O--){V=J[O];if(V&&V[0]==L&&V[1]==K&&V[2]==T){J.splice(O,1);return true;}}return false;}var P=null;var Q=arguments[3];if("undefined"===typeof Q){Q=this._getCacheIndex(L,K,T);}if(Q>=0){P=I[Q];}if(!L||!P){return false;}if(this.useLegacyEvent(L,K)){var N=this.getLegacyIndex(L,K);var M=E[N];if(M){for(O=0,R=M.length;O<R;++O){V=M[O];if(V&&V[this.EL]==L&&V[this.TYPE]==K&&V[this.FN]==T){M.splice(O,1);break;}}}}else{try{this._simpleRemove(L,K,P[this.WFN],false);}catch(S){this.lastError=S;return false;}}delete I[Q][this.WFN];delete I[Q][this.FN];I.splice(Q,1);return true;},getTarget:function(M,L){var K=M.target||M.srcElement;return this.resolveTextNode(K);},resolveTextNode:function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},getPageX:function(L){var K=L.pageX;if(!K&&0!==K){K=L.clientX||0;if(this.isIE){K+=this._getScrollLeft();}}return K;},getPageY:function(K){var L=K.pageY;if(!L&&0!==L){L=K.clientY||0;if(this.isIE){L+=this._getScrollTop();}}return L;},getXY:function(K){return[this.getPageX(K),this.getPageY(K)];},getRelatedTarget:function(L){var K=L.relatedTarget;
if(!K){if(L.type=="mouseout"){K=L.toElement;}else{if(L.type=="mouseover"){K=L.fromElement;}}}return this.resolveTextNode(K);},getTime:function(M){if(!M.time){var L=new Date().getTime();try{M.time=L;}catch(K){this.lastError=K;return L;}}return M.time;},stopEvent:function(K){this.stopPropagation(K);this.preventDefault(K);},stopPropagation:function(K){if(K.stopPropagation){K.stopPropagation();}else{K.cancelBubble=true;}},preventDefault:function(K){if(K.preventDefault){K.preventDefault();}else{K.returnValue=false;}},getEvent:function(M,K){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break;}N=N.caller;}}return L;},getCharCode:function(L){var K=L.keyCode||L.charCode||0;if(YAHOO.env.ua.webkit&&(K in D)){K=D[K];}return K;},_getCacheIndex:function(O,P,N){for(var M=0,L=I.length;M<L;M=M+1){var K=I[M];if(K&&K[this.FN]==N&&K[this.EL]==O&&K[this.TYPE]==P){return M;}}return-1;},generateId:function(K){var L=K.id;if(!L){L="yuievtautoid-"+A;++A;K.id=L;}return L;},_isValidCollection:function(L){try{return(L&&typeof L!=="string"&&L.length&&!L.tagName&&!L.alert&&typeof L[0]!=="undefined");}catch(K){return false;}},elCache:{},getEl:function(K){return(typeof K==="string")?document.getElementById(K):K;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(L){if(!H){H=true;var K=YAHOO.util.Event;K._ready();K._tryPreloadAttach();}},_ready:function(L){var K=YAHOO.util.Event;if(!K.DOMReady){K.DOMReady=true;K.DOMReadyEvent.fire();K._simpleRemove(document,"DOMContentLoaded",K._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;clearInterval(this._interval);this._interval=null;return;}if(this.locked){return;}if(this.isIE){if(!this.DOMReady){this.startInterval();return;}}this.locked=true;var Q=!H;if(!Q){Q=(C>0&&F.length>0);}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}U.fn.call(S,U.obj);};var L,K,O,N,M=[];for(L=0,K=F.length;L<K;L=L+1){O=F[L];if(O){N=this.getEl(O.id);if(N){if(O.checkReady){if(H||N.nextSibling||!Q){M.push(O);F[L]=null;}}else{R(N,O);F[L]=null;}}else{P.push(O);}}}for(L=0,K=M.length;L<K;L=L+1){O=M[L];R(this.getEl(O.id),O);}C--;if(Q){for(L=F.length-1;L>-1;L--){O=F[L];if(!O||!O.id){F.splice(L,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(O,P,R){var M=(YAHOO.lang.isString(O))?this.getEl(O):O;var Q=this.getListeners(M,R),N,K;if(Q){for(N=Q.length-1;N>-1;N--){var L=Q[N];this.removeListener(M,L.type,L.fn);}}if(P&&M&&M.childNodes){for(N=0,K=M.childNodes.length;N<K;++N){this.purgeElement(M.childNodes[N],P,R);}}},getListeners:function(M,K){var P=[],L;if(!K){L=[I,J];}else{if(K==="unload"){L=[J];}else{L=[I];}}var R=(YAHOO.lang.isString(M))?this.getEl(M):M;for(var O=0;O<L.length;O=O+1){var T=L[O];if(T){for(var Q=0,S=T.length;Q<S;++Q){var N=T[Q];if(N&&N[this.EL]===R&&(!K||K===N[this.TYPE])){P.push({type:N[this.TYPE],fn:N[this.FN],obj:N[this.OBJ],adjust:N[this.OVERRIDE],scope:N[this.ADJ_SCOPE],index:Q});}}}}return(P.length)?P:null;},_unload:function(Q){var K=YAHOO.util.Event,N,M,L,P,O,R=J.slice();for(N=0,P=J.length;N<P;++N){L=R[N];if(L){var S=window;if(L[K.ADJ_SCOPE]){if(L[K.ADJ_SCOPE]===true){S=L[K.UNLOAD_OBJ];}else{S=L[K.ADJ_SCOPE];}}L[K.FN].call(S,K.getEvent(Q,L[K.EL]),L[K.UNLOAD_OBJ]);R[N]=null;L=null;S=null;}}J=null;if(I){for(M=I.length-1;M>-1;M--){L=I[M];if(L){K.removeListener(L[K.EL],L[K.TYPE],L[K.FN],M);}}L=null;}G=null;K._simpleRemove(window,"unload",K._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var K=document.documentElement,L=document.body;if(K&&(K.scrollTop||K.scrollLeft)){return[K.scrollTop,K.scrollLeft];}else{if(L){return[L.scrollTop,L.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(M,N,L,K){M.addEventListener(N,L,(K));};}else{if(window.attachEvent){return function(M,N,L,K){M.attachEvent("on"+N,L);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(M,N,L,K){M.removeEventListener(N,L,(K));};}else{if(window.detachEvent){return function(L,M,K){L.detachEvent("on"+M,K);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);
I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.5.1",build:"984"});YAHOO.register("yahoo-dom-event",YAHOO,{version:"2.5.1",build:"984"});
(function(){
var Y=YAHOO.util;
var Anim=function(el,attributes,duration,method){
if(!el){}
this.init(el,attributes,duration,method);};
Anim.NAME='Anim';
Anim.prototype={
toString:function(){
var el=this.getEl()||{};
var id=el.id||el.tagName;
return(this.constructor.NAME+': '+id);},
patterns:{
noNegatives:/width|height|opacity|padding/i,
offsetAttribute:/^((width|height)|(top|left))$/,
defaultUnit:/width|height|top$|bottom$|left$|right$/i,
offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},
doMethod:function(attr,start,end){
return this.method(this.currentFrame,start,end-start,this.totalFrames);},
setAttribute:function(attr,val,unit){
if(this.patterns.noNegatives.test(attr)){
val=(val>0)?val:0;}
Y.Dom.setStyle(this.getEl(),attr,val+unit);},
getAttribute:function(attr){
var el=this.getEl();
var val=Y.Dom.getStyle(el,attr);
if(val!=='auto'&&!this.patterns.offsetUnit.test(val)){
return parseFloat(val);}
var a=this.patterns.offsetAttribute.exec(attr)||[];
var pos=!!(a[3]);
var box=!!(a[2]);
if(box||(Y.Dom.getStyle(el,'position')=='absolute'&&pos)){
val=el['offset'+a[0].charAt(0).toUpperCase()+a[0].substr(1)];}else{
val=0;}
return val;},
getDefaultUnit:function(attr){
if(this.patterns.defaultUnit.test(attr)){
return'px';}
return'';},
setRuntimeAttribute:function(attr){
var start;
var end;
var attributes=this.attributes;
this.runtimeAttributes[attr]={};
var isset=function(prop){
return(typeof prop!=='undefined');};
if(!isset(attributes[attr]['to'])&&!isset(attributes[attr]['by'])){
return false;}
start=(isset(attributes[attr]['from']))?attributes[attr]['from']:this.getAttribute(attr);
if(isset(attributes[attr]['to'])){
end=attributes[attr]['to'];}else if(isset(attributes[attr]['by'])){
if(start.constructor==Array){
end=[];
for(var i=0,len=start.length;i<len;++i){
end[i]=start[i]+attributes[attr]['by'][i]*1;}}else{
end=start+attributes[attr]['by']*1;}}
this.runtimeAttributes[attr].start=start;
this.runtimeAttributes[attr].end=end;
this.runtimeAttributes[attr].unit=(isset(attributes[attr].unit))?
attributes[attr]['unit']:this.getDefaultUnit(attr);
return true;},
init:function(el,attributes,duration,method){
var isAnimated=false;
var startTime=null;
var actualFrames=0;
el=Y.Dom.get(el);
this.attributes=attributes||{};
this.duration=!YAHOO.lang.isUndefined(duration)?duration:1;
this.method=method||Y.Easing.easeNone;
this.useSeconds=true;
this.currentFrame=0;
this.totalFrames=Y.AnimMgr.fps;
this.setEl=function(element){
el=Y.Dom.get(element);};
this.getEl=function(){return el;};
this.isAnimated=function(){
return isAnimated;};
this.getStartTime=function(){
return startTime;};
this.runtimeAttributes={};
this.animate=function(){
if(this.isAnimated()){
return false;}
this.currentFrame=0;
this.totalFrames=(this.useSeconds)?Math.ceil(Y.AnimMgr.fps*this.duration):this.duration;
if(this.duration===0&&this.useSeconds){
this.totalFrames=1;}
Y.AnimMgr.registerElement(this);
return true;};
this.stop=function(finish){
if(!this.isAnimated()){
return false;}
if(finish){
this.currentFrame=this.totalFrames;
this._onTween.fire();}
Y.AnimMgr.stop(this);};
var onStart=function(){
this.onStart.fire();
this.runtimeAttributes={};
for(var attr in this.attributes){
this.setRuntimeAttribute(attr);}
isAnimated=true;
actualFrames=0;
startTime=new Date();};
var onTween=function(){
var data={
duration:new Date()-this.getStartTime(),
currentFrame:this.currentFrame};
data.toString=function(){
return('duration: '+data.duration+', currentFrame: '+data.currentFrame);};
this.onTween.fire(data);
var runtimeAttributes=this.runtimeAttributes;
for(var attr in runtimeAttributes){
this.setAttribute(attr,this.doMethod(attr,runtimeAttributes[attr].start,runtimeAttributes[attr].end),runtimeAttributes[attr].unit);}
actualFrames+=1;};
var onComplete=function(){
var actual_duration=(new Date()-startTime)/1000;
var data={
duration:actual_duration,
frames:actualFrames,
fps:actualFrames/actual_duration};
data.toString=function(){
return('duration: '+data.duration+', frames: '+data.frames+', fps: '+data.fps);};
isAnimated=false;
actualFrames=0;
this.onComplete.fire(data);};
this._onStart=new Y.CustomEvent('_start',this,true);
this.onStart=new Y.CustomEvent('start',this);
this.onTween=new Y.CustomEvent('tween',this);
this._onTween=new Y.CustomEvent('_tween',this,true);
this.onComplete=new Y.CustomEvent('complete',this);
this._onComplete=new Y.CustomEvent('_complete',this,true);
this._onStart.subscribe(onStart);
this._onTween.subscribe(onTween);
this._onComplete.subscribe(onComplete);}};
Y.Anim=Anim;})();
YAHOO.util.AnimMgr=new function(){
var thread=null;
var queue=[];
var tweenCount=0;
this.fps=1000;
this.delay=1;
this.registerElement=function(tween){
queue[queue.length]=tween;
tweenCount+=1;
tween._onStart.fire();
this.start();};
this.unRegister=function(tween,index){
index=index||getIndex(tween);
if(!tween.isAnimated()||index==-1){
return false;}
tween._onComplete.fire();
queue.splice(index,1);
tweenCount-=1;
if(tweenCount<=0){
this.stop();}
return true;};
this.start=function(){
if(thread===null){
thread=setInterval(this.run,this.delay);}};
this.stop=function(tween){
if(!tween){
clearInterval(thread);
for(var i=0,len=queue.length;i<len;++i){
this.unRegister(queue[0],0);}
queue=[];
thread=null;
tweenCount=0;}
else{
this.unRegister(tween);}};
this.run=function(){
for(var i=0,len=queue.length;i<len;++i){
var tween=queue[i];
if(!tween||!tween.isAnimated()){continue;}
if(tween.currentFrame<tween.totalFrames||tween.totalFrames===null)
{
tween.currentFrame+=1;
if(tween.useSeconds){
correctFrame(tween);}
tween._onTween.fire();}
else{YAHOO.util.AnimMgr.stop(tween,i);}}};
var getIndex=function(anim){
for(var i=0,len=queue.length;i<len;++i){
if(queue[i]==anim){
return i;}}
return-1;};
var correctFrame=function(tween){
var frames=tween.totalFrames;
var frame=tween.currentFrame;
var expected=(tween.currentFrame*tween.duration*1000/tween.totalFrames);
var elapsed=(new Date()-tween.getStartTime());
var tweak=0;
if(elapsed<tween.duration*1000){
tweak=Math.round((elapsed/expected-1)*tween.currentFrame);}else{
tweak=frames-(frame+1);}
if(tweak>0&&isFinite(tweak)){
if(tween.currentFrame+tweak>=frames){
tweak=frames-(frame+1);}
tween.currentFrame+=tweak;}};};
YAHOO.util.Bezier=new function(){
this.getPosition=function(points,t){
var n=points.length;
var tmp=[];
for(var i=0;i<n;++i){
tmp[i]=[points[i][0],points[i][1]];}
for(var j=1;j<n;++j){
for(i=0;i<n-j;++i){
tmp[i][0]=(1-t)*tmp[i][0]+t*tmp[parseInt(i+1,10)][0];
tmp[i][1]=(1-t)*tmp[i][1]+t*tmp[parseInt(i+1,10)][1];}}
return[tmp[0][0],tmp[0][1]];};};
(function(){
var ColorAnim=function(el,attributes,duration,method){
ColorAnim.superclass.constructor.call(this,el,attributes,duration,method);};
ColorAnim.NAME='ColorAnim';
var Y=YAHOO.util;
YAHOO.extend(ColorAnim,Y.Anim);
var superclass=ColorAnim.superclass;
var proto=ColorAnim.prototype;
proto.patterns.color=/color$/i;
proto.patterns.rgb=/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i;
proto.patterns.hex=/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i;
proto.patterns.hex3=/^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i;
proto.patterns.transparent=/^transparent|rgba\(0, 0, 0, 0\)$/;
proto.parseColor=function(s){
if(s.length==3){return s;}
var c=this.patterns.hex.exec(s);
if(c&&c.length==4){
return[parseInt(c[1],16),parseInt(c[2],16),parseInt(c[3],16)];}
c=this.patterns.rgb.exec(s);
if(c&&c.length==4){
return[parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}
c=this.patterns.hex3.exec(s);
if(c&&c.length==4){
return[parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16),parseInt(c[3]+c[3],16)];}
return null;};
proto.getAttribute=function(attr){
var el=this.getEl();
if(this.patterns.color.test(attr)){
var val=YAHOO.util.Dom.getStyle(el,attr);
if(this.patterns.transparent.test(val)){
var parent=el.parentNode;
val=Y.Dom.getStyle(parent,attr);
while(parent&&this.patterns.transparent.test(val)){
parent=parent.parentNode;
val=Y.Dom.getStyle(parent,attr);
if(parent.tagName.toUpperCase()=='HTML'){
val='#fff';}}}}else{
val=superclass.getAttribute.call(this,attr);}
return val;};
proto.doMethod=function(attr,start,end){
var val;
if(this.patterns.color.test(attr)){
val=[];
for(var i=0,len=start.length;i<len;++i){
val[i]=superclass.doMethod.call(this,attr,start[i],end[i]);}
val='rgb('+Math.floor(val[0])+','+Math.floor(val[1])+','+Math.floor(val[2])+')';}
else{
val=superclass.doMethod.call(this,attr,start,end);}
return val;};
proto.setRuntimeAttribute=function(attr){
superclass.setRuntimeAttribute.call(this,attr);
if(this.patterns.color.test(attr)){
var attributes=this.attributes;
var start=this.parseColor(this.runtimeAttributes[attr].start);
var end=this.parseColor(this.runtimeAttributes[attr].end);
if(typeof attributes[attr]['to']==='undefined'&&typeof attributes[attr]['by']!=='undefined'){
end=this.parseColor(attributes[attr].by);
for(var i=0,len=start.length;i<len;++i){
end[i]=start[i]+end[i];}}
this.runtimeAttributes[attr].start=start;
this.runtimeAttributes[attr].end=end;}};
Y.ColorAnim=ColorAnim;})();
YAHOO.util.Easing={
easeNone:function(t,b,c,d){
return c*t/d+b;},
easeIn:function(t,b,c,d){
return c*(t/=d)*t+b;},
easeOut:function(t,b,c,d){
return-c*(t/=d)*(t-2)+b;},
easeBoth:function(t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t+b;}
return-c/2*((--t)*(t-2)-1)+b;},
easeInStrong:function(t,b,c,d){
return c*(t/=d)*t*t*t+b;},
easeOutStrong:function(t,b,c,d){
return-c*((t=t/d-1)*t*t*t-1)+b;},
easeBothStrong:function(t,b,c,d){
if((t/=d/2)<1){
return c/2*t*t*t*t+b;}
return-c/2*((t-=2)*t*t*t-2)+b;},
elasticIn:function(t,b,c,d,a,p){
if(t==0){
return b;}
if((t/=d)==1){
return b+c;}
if(!p){
p=d*.3;}
if(!a||a<Math.abs(c)){
a=c;
var s=p/4;}
else{
var s=p/(2*Math.PI)*Math.asin(c/a);}
return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},
elasticOut:function(t,b,c,d,a,p){
if(t==0){
return b;}
if((t/=d)==1){
return b+c;}
if(!p){
p=d*.3;}
if(!a||a<Math.abs(c)){
a=c;
var s=p/4;}
else{
var s=p/(2*Math.PI)*Math.asin(c/a);}
return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},
elasticBoth:function(t,b,c,d,a,p){
if(t==0){
return b;}
if((t/=d/2)==2){
return b+c;}
if(!p){
p=d*(.3*1.5);}
if(!a||a<Math.abs(c)){
a=c;
var s=p/4;}
else{
var s=p/(2*Math.PI)*Math.asin(c/a);}
if(t<1){
return-.5*(a*Math.pow(2,10*(t-=1))*
Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
return a*Math.pow(2,-10*(t-=1))*
Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},
backIn:function(t,b,c,d,s){
if(typeof s=='undefined'){
s=1.70158;}
return c*(t/=d)*t*((s+1)*t-s)+b;},
backOut:function(t,b,c,d,s){
if(typeof s=='undefined'){
s=1.70158;}
return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},
backBoth:function(t,b,c,d,s){
if(typeof s=='undefined'){
s=1.70158;}
if((t/=d/2)<1){
return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},
bounceIn:function(t,b,c,d){
return c-YAHOO.util.Easing.bounceOut(d-t,0,c,d)+b;},
bounceOut:function(t,b,c,d){
if((t/=d)<(1/2.75)){
return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){
return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){
return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}
return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;},
bounceBoth:function(t,b,c,d){
if(t<d/2){
return YAHOO.util.Easing.bounceIn(t*2,0,c,d)*.5+b;}
return YAHOO.util.Easing.bounceOut(t*2-d,0,c,d)*.5+c*.5+b;}};
(function(){
var Motion=function(el,attributes,duration,method){
if(el){
Motion.superclass.constructor.call(this,el,attributes,duration,method);}};
Motion.NAME='Motion';
var Y=YAHOO.util;
YAHOO.extend(Motion,Y.ColorAnim);
var superclass=Motion.superclass;
var proto=Motion.prototype;
proto.patterns.points=/^points$/i;
proto.setAttribute=function(attr,val,unit){
if(this.patterns.points.test(attr)){
unit=unit||'px';
superclass.setAttribute.call(this,'left',val[0],unit);
superclass.setAttribute.call(this,'top',val[1],unit);}else{
superclass.setAttribute.call(this,attr,val,unit);}};
proto.getAttribute=function(attr){
if(this.patterns.points.test(attr)){
var val=[
superclass.getAttribute.call(this,'left'),
superclass.getAttribute.call(this,'top')];}else{
val=superclass.getAttribute.call(this,attr);}
return val;};
proto.doMethod=function(attr,start,end){
var val=null;
if(this.patterns.points.test(attr)){
var t=this.method(this.currentFrame,0,100,this.totalFrames)/100;
val=Y.Bezier.getPosition(this.runtimeAttributes[attr],t);}else{
val=superclass.doMethod.call(this,attr,start,end);}
return val;};
proto.setRuntimeAttribute=function(attr){
if(this.patterns.points.test(attr)){
var el=this.getEl();
var attributes=this.attributes;
var start;
var control=attributes['points']['control']||[];
var end;
var i,len;
if(control.length>0&&!(control[0]instanceof Array)){
control=[control];}else{
var tmp=[];
for(i=0,len=control.length;i<len;++i){
tmp[i]=control[i];}
control=tmp;}
if(Y.Dom.getStyle(el,'position')=='static'){
Y.Dom.setStyle(el,'position','relative');}
if(isset(attributes['points']['from'])){
Y.Dom.setXY(el,attributes['points']['from']);}
else{Y.Dom.setXY(el,Y.Dom.getXY(el));}
start=this.getAttribute('points');
if(isset(attributes['points']['to'])){
end=translateValues.call(this,attributes['points']['to'],start);
var pageXY=Y.Dom.getXY(this.getEl());
for(i=0,len=control.length;i<len;++i){
control[i]=translateValues.call(this,control[i],start);}}else if(isset(attributes['points']['by'])){
end=[start[0]+attributes['points']['by'][0],start[1]+attributes['points']['by'][1]];
for(i=0,len=control.length;i<len;++i){
control[i]=[start[0]+control[i][0],start[1]+control[i][1]];}}
this.runtimeAttributes[attr]=[start];
if(control.length>0){
this.runtimeAttributes[attr]=this.runtimeAttributes[attr].concat(control);}
this.runtimeAttributes[attr][this.runtimeAttributes[attr].length]=end;}
else{
superclass.setRuntimeAttribute.call(this,attr);}};
var translateValues=function(val,start){
var pageXY=Y.Dom.getXY(this.getEl());
val=[val[0]-pageXY[0]+start[0],val[1]-pageXY[1]+start[1]];
return val;};
var isset=function(prop){
return(typeof prop!=='undefined');};
Y.Motion=Motion;})();
(function(){
var Scroll=function(el,attributes,duration,method){
if(el){
Scroll.superclass.constructor.call(this,el,attributes,duration,method);}};
Scroll.NAME='Scroll';
var Y=YAHOO.util;
YAHOO.extend(Scroll,Y.ColorAnim);
var superclass=Scroll.superclass;
var proto=Scroll.prototype;
proto.doMethod=function(attr,start,end){
var val=null;
if(attr=='scroll'){
val=[
this.method(this.currentFrame,start[0],end[0]-start[0],this.totalFrames),
this.method(this.currentFrame,start[1],end[1]-start[1],this.totalFrames)];}else{
val=superclass.doMethod.call(this,attr,start,end);}
return val;};
proto.getAttribute=function(attr){
var val=null;
var el=this.getEl();
if(attr=='scroll'){
val=[el.scrollLeft,el.scrollTop];}else{
val=superclass.getAttribute.call(this,attr);}
return val;};
proto.setAttribute=function(attr,val,unit){
var el=this.getEl();
if(attr=='scroll'){
el.scrollLeft=val[0];
el.scrollTop=val[1];}else{
superclass.setAttribute.call(this,attr,val,unit);}};
Y.Scroll=Scroll;})();
YAHOO.register("animation",YAHOO.util.Anim,{version:"2.5.1",build:"984"});
(function(){
YAHOO.util.Config=function(owner){
if(owner){
this.init(owner);}};
var Lang=YAHOO.lang,
CustomEvent=YAHOO.util.CustomEvent,
Config=YAHOO.util.Config;
Config.CONFIG_CHANGED_EVENT="configChanged";
Config.BOOLEAN_TYPE="boolean";
Config.prototype={
owner:null,
queueInProgress:false,
config:null,
initialConfig:null,
eventQueue:null,
configChangedEvent:null,
init:function(owner){
this.owner=owner;
this.configChangedEvent=
this.createEvent(Config.CONFIG_CHANGED_EVENT);
this.configChangedEvent.signature=CustomEvent.LIST;
this.queueInProgress=false;
this.config={};
this.initialConfig={};
this.eventQueue=[];},
checkBoolean:function(val){
return(typeof val==Config.BOOLEAN_TYPE);},
checkNumber:function(val){
return(!isNaN(val));},
fireEvent:function(key,value){
var property=this.config[key];
if(property&&property.event){
property.event.fire(value);}},
addProperty:function(key,propertyObject){
key=key.toLowerCase();
this.config[key]=propertyObject;
propertyObject.event=this.createEvent(key,{scope:this.owner});
propertyObject.event.signature=CustomEvent.LIST;
propertyObject.key=key;
if(propertyObject.handler){
propertyObject.event.subscribe(propertyObject.handler,
this.owner);}
this.setProperty(key,propertyObject.value,true);
if(!propertyObject.suppressEvent){
this.queueProperty(key,propertyObject.value);}},
getConfig:function(){
var cfg={},
prop,
property;
for(prop in this.config){
property=this.config[prop];
if(property&&property.event){
cfg[prop]=property.value;}}
return cfg;},
getProperty:function(key){
var property=this.config[key.toLowerCase()];
if(property&&property.event){
return property.value;}else{
return undefined;}},
resetProperty:function(key){
key=key.toLowerCase();
var property=this.config[key];
if(property&&property.event){
if(this.initialConfig[key]&&!Lang.isUndefined(this.initialConfig[key])){
this.setProperty(key,this.initialConfig[key]);
return true;}}else{
return false;}},
setProperty:function(key,value,silent){
var property;
key=key.toLowerCase();
if(this.queueInProgress&&!silent){
this.queueProperty(key,value);
return true;}else{
property=this.config[key];
if(property&&property.event){
if(property.validator&&!property.validator(value)){
return false;}else{
property.value=value;
if(!silent){
this.fireEvent(key,value);
this.configChangedEvent.fire([key,value]);}
return true;}}else{
return false;}}},
queueProperty:function(key,value){
key=key.toLowerCase();
var property=this.config[key],
foundDuplicate=false,
iLen,
queueItem,
queueItemKey,
queueItemValue,
sLen,
supercedesCheck,
qLen,
queueItemCheck,
queueItemCheckKey,
queueItemCheckValue,
i,
s,
q;
if(property&&property.event){
if(!Lang.isUndefined(value)&&property.validator&&!property.validator(value)){
return false;}else{
if(!Lang.isUndefined(value)){
property.value=value;}else{
value=property.value;}
foundDuplicate=false;
iLen=this.eventQueue.length;
for(i=0;i<iLen;i++){
queueItem=this.eventQueue[i];
if(queueItem){
queueItemKey=queueItem[0];
queueItemValue=queueItem[1];
if(queueItemKey==key){
this.eventQueue[i]=null;
this.eventQueue.push(
[key,(!Lang.isUndefined(value)?
value:queueItemValue)]);
foundDuplicate=true;
break;}}}
if(!foundDuplicate&&!Lang.isUndefined(value)){
this.eventQueue.push([key,value]);}}
if(property.supercedes){
sLen=property.supercedes.length;
for(s=0;s<sLen;s++){
supercedesCheck=property.supercedes[s];
qLen=this.eventQueue.length;
for(q=0;q<qLen;q++){
queueItemCheck=this.eventQueue[q];
if(queueItemCheck){
queueItemCheckKey=queueItemCheck[0];
queueItemCheckValue=queueItemCheck[1];
if(queueItemCheckKey==
supercedesCheck.toLowerCase()){
this.eventQueue.push([queueItemCheckKey,
queueItemCheckValue]);
this.eventQueue[q]=null;
break;}}}}}
return true;}else{
return false;}},
refireEvent:function(key){
key=key.toLowerCase();
var property=this.config[key];
if(property&&property.event&&!Lang.isUndefined(property.value)){
if(this.queueInProgress){
this.queueProperty(key);}else{
this.fireEvent(key,property.value);}}},
applyConfig:function(userConfig,init){
var sKey,
oConfig;
if(init){
oConfig={};
for(sKey in userConfig){
if(Lang.hasOwnProperty(userConfig,sKey)){
oConfig[sKey.toLowerCase()]=userConfig[sKey];}}
this.initialConfig=oConfig;}
for(sKey in userConfig){
if(Lang.hasOwnProperty(userConfig,sKey)){
this.queueProperty(sKey,userConfig[sKey]);}}},
refresh:function(){
var prop;
for(prop in this.config){
this.refireEvent(prop);}},
fireQueue:function(){
var i,
queueItem,
key,
value,
property;
this.queueInProgress=true;
for(i=0;i<this.eventQueue.length;i++){
queueItem=this.eventQueue[i];
if(queueItem){
key=queueItem[0];
value=queueItem[1];
property=this.config[key];
property.value=value;
this.fireEvent(key,value);}}
this.queueInProgress=false;
this.eventQueue=[];},
subscribeToConfigEvent:function(key,handler,obj,override){
var property=this.config[key.toLowerCase()];
if(property&&property.event){
if(!Config.alreadySubscribed(property.event,handler,obj)){
property.event.subscribe(handler,obj,override);}
return true;}else{
return false;}},
unsubscribeFromConfigEvent:function(key,handler,obj){
var property=this.config[key.toLowerCase()];
if(property&&property.event){
return property.event.unsubscribe(handler,obj);}else{
return false;}},
toString:function(){
var output="Config";
if(this.owner){
output+=" ["+this.owner.toString()+"]";}
return output;},
outputEventQueue:function(){
var output="",
queueItem,
q,
nQueue=this.eventQueue.length;
for(q=0;q<nQueue;q++){
queueItem=this.eventQueue[q];
if(queueItem){
output+=queueItem[0]+"="+queueItem[1]+", ";}}
return output;},
destroy:function(){
var oConfig=this.config,
sProperty,
oProperty;
for(sProperty in oConfig){
if(Lang.hasOwnProperty(oConfig,sProperty)){
oProperty=oConfig[sProperty];
oProperty.event.unsubscribeAll();
oProperty.event=null;}}
this.configChangedEvent.unsubscribeAll();
this.configChangedEvent=null;
this.owner=null;
this.config=null;
this.initialConfig=null;
this.eventQueue=null;}};
Config.alreadySubscribed=function(evt,fn,obj){
var nSubscribers=evt.subscribers.length,
subsc,
i;
if(nSubscribers>0){
i=nSubscribers-1;
do{
subsc=evt.subscribers[i];
if(subsc&&subsc.obj==obj&&subsc.fn==fn){
return true;}}
while(i--);}
return false;};
YAHOO.lang.augmentProto(Config,YAHOO.util.EventProvider);}());
(function(){
YAHOO.widget.Module=function(el,userConfig){
if(el){
this.init(el,userConfig);}else{}};
var Dom=YAHOO.util.Dom,
Config=YAHOO.util.Config,
Event=YAHOO.util.Event,
CustomEvent=YAHOO.util.CustomEvent,
Module=YAHOO.widget.Module,
m_oModuleTemplate,
m_oHeaderTemplate,
m_oBodyTemplate,
m_oFooterTemplate,
EVENT_TYPES={"BEFORE_INIT":"beforeInit","INIT":"init","APPEND":"append","BEFORE_RENDER":"beforeRender","RENDER":"render","CHANGE_HEADER":"changeHeader","CHANGE_BODY":"changeBody","CHANGE_FOOTER":"changeFooter","CHANGE_CONTENT":"changeContent","DESTORY":"destroy","BEFORE_SHOW":"beforeShow","SHOW":"show","BEFORE_HIDE":"beforeHide","HIDE":"hide"},
DEFAULT_CONFIG={"VISIBLE":{
key:"visible",
value:true,
validator:YAHOO.lang.isBoolean},"EFFECT":{
key:"effect",
suppressEvent:true,
supercedes:["visible"]},"MONITOR_RESIZE":{
key:"monitorresize",
value:true},"APPEND_TO_DOCUMENT_BODY":{
key:"appendtodocumentbody",
value:false}};
Module.IMG_ROOT=null;
Module.IMG_ROOT_SSL=null;
Module.CSS_MODULE="yui-module";
Module.CSS_HEADER="hd";
Module.CSS_BODY="bd";
Module.CSS_FOOTER="ft";
Module.RESIZE_MONITOR_SECURE_URL="javascript:false;";
Module.textResizeEvent=new CustomEvent("textResize");
function createModuleTemplate(){
if(!m_oModuleTemplate){
m_oModuleTemplate=document.createElement("div");
m_oModuleTemplate.innerHTML=("<div class=\""+
Module.CSS_HEADER+"\"></div>"+"<div class=\""+
Module.CSS_BODY+"\"></div><div class=\""+
Module.CSS_FOOTER+"\"></div>");
m_oHeaderTemplate=m_oModuleTemplate.firstChild;
m_oBodyTemplate=m_oHeaderTemplate.nextSibling;
m_oFooterTemplate=m_oBodyTemplate.nextSibling;}
return m_oModuleTemplate;}
function createHeader(){
if(!m_oHeaderTemplate){
createModuleTemplate();}
return(m_oHeaderTemplate.cloneNode(false));}
function createBody(){
if(!m_oBodyTemplate){
createModuleTemplate();}
return(m_oBodyTemplate.cloneNode(false));}
function createFooter(){
if(!m_oFooterTemplate){
createModuleTemplate();}
return(m_oFooterTemplate.cloneNode(false));}
Module.prototype={
constructor:Module,
element:null,
header:null,
body:null,
footer:null,
id:null,
imageRoot:Module.IMG_ROOT,
initEvents:function(){
var SIGNATURE=CustomEvent.LIST;
this.beforeInitEvent=this.createEvent(EVENT_TYPES.BEFORE_INIT);
this.beforeInitEvent.signature=SIGNATURE;
this.initEvent=this.createEvent(EVENT_TYPES.INIT);
this.initEvent.signature=SIGNATURE;
this.appendEvent=this.createEvent(EVENT_TYPES.APPEND);
this.appendEvent.signature=SIGNATURE;
this.beforeRenderEvent=this.createEvent(EVENT_TYPES.BEFORE_RENDER);
this.beforeRenderEvent.signature=SIGNATURE;
this.renderEvent=this.createEvent(EVENT_TYPES.RENDER);
this.renderEvent.signature=SIGNATURE;
this.changeHeaderEvent=this.createEvent(EVENT_TYPES.CHANGE_HEADER);
this.changeHeaderEvent.signature=SIGNATURE;
this.changeBodyEvent=this.createEvent(EVENT_TYPES.CHANGE_BODY);
this.changeBodyEvent.signature=SIGNATURE;
this.changeFooterEvent=this.createEvent(EVENT_TYPES.CHANGE_FOOTER);
this.changeFooterEvent.signature=SIGNATURE;
this.changeContentEvent=this.createEvent(EVENT_TYPES.CHANGE_CONTENT);
this.changeContentEvent.signature=SIGNATURE;
this.destroyEvent=this.createEvent(EVENT_TYPES.DESTORY);
this.destroyEvent.signature=SIGNATURE;
this.beforeShowEvent=this.createEvent(EVENT_TYPES.BEFORE_SHOW);
this.beforeShowEvent.signature=SIGNATURE;
this.showEvent=this.createEvent(EVENT_TYPES.SHOW);
this.showEvent.signature=SIGNATURE;
this.beforeHideEvent=this.createEvent(EVENT_TYPES.BEFORE_HIDE);
this.beforeHideEvent.signature=SIGNATURE;
this.hideEvent=this.createEvent(EVENT_TYPES.HIDE);
this.hideEvent.signature=SIGNATURE;},
platform:function(){
var ua=navigator.userAgent.toLowerCase();
if(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1){
return"windows";}else if(ua.indexOf("macintosh")!=-1){
return"mac";}else{
return false;}}(),
browser:function(){
var ua=navigator.userAgent.toLowerCase();
if(ua.indexOf('opera')!=-1){
return'opera';}else if(ua.indexOf('msie 7')!=-1){
return'ie7';}else if(ua.indexOf('msie')!=-1){
return'ie';}else if(ua.indexOf('safari')!=-1){
return'safari';}else if(ua.indexOf('gecko')!=-1){
return'gecko';}else{
return false;}}(),
isSecure:function(){
if(window.location.href.toLowerCase().indexOf("https")===0){
return true;}else{
return false;}}(),
initDefaultConfig:function(){
this.cfg.addProperty(DEFAULT_CONFIG.VISIBLE.key,{
handler:this.configVisible,
value:DEFAULT_CONFIG.VISIBLE.value,
validator:DEFAULT_CONFIG.VISIBLE.validator});
this.cfg.addProperty(DEFAULT_CONFIG.EFFECT.key,{
suppressEvent:DEFAULT_CONFIG.EFFECT.suppressEvent,
supercedes:DEFAULT_CONFIG.EFFECT.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.MONITOR_RESIZE.key,{
handler:this.configMonitorResize,
value:DEFAULT_CONFIG.MONITOR_RESIZE.value});
this.cfg.addProperty(DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.key,{
value:DEFAULT_CONFIG.APPEND_TO_DOCUMENT_BODY.value});},
init:function(el,userConfig){
var elId,child;
this.initEvents();
this.beforeInitEvent.fire(Module);
this.cfg=new Config(this);
if(this.isSecure){
this.imageRoot=Module.IMG_ROOT_SSL;}
if(typeof el=="string"){
elId=el;
el=document.getElementById(el);
if(!el){
el=(createModuleTemplate()).cloneNode(false);
el.id=elId;}}
this.element=el;
if(el.id){
this.id=el.id;}
child=this.element.firstChild;
if(child){
var fndHd=false,fndBd=false,fndFt=false;
do{
if(1==child.nodeType){
if(!fndHd&&Dom.hasClass(child,Module.CSS_HEADER)){
this.header=child;
fndHd=true;}else if(!fndBd&&Dom.hasClass(child,Module.CSS_BODY)){
this.body=child;
fndBd=true;}else if(!fndFt&&Dom.hasClass(child,Module.CSS_FOOTER)){
this.footer=child;
fndFt=true;}}}while((child=child.nextSibling));}
this.initDefaultConfig();
Dom.addClass(this.element,Module.CSS_MODULE);
if(userConfig){
this.cfg.applyConfig(userConfig,true);}
if(!Config.alreadySubscribed(this.renderEvent,this.cfg.fireQueue,this.cfg)){
this.renderEvent.subscribe(this.cfg.fireQueue,this.cfg,true);}
this.initEvent.fire(Module);},
initResizeMonitor:function(){
var isGeckoWin=(YAHOO.env.ua.gecko&&this.platform=="windows");
if(isGeckoWin){
var self=this;
setTimeout(function(){self._initResizeMonitor();},0);}else{
this._initResizeMonitor();}},
_initResizeMonitor:function(){
var oDoc,
oIFrame,
sHTML;
function fireTextResize(){
Module.textResizeEvent.fire();}
if(!YAHOO.env.ua.opera){
oIFrame=Dom.get("_yuiResizeMonitor");
var supportsCWResize=this._supportsCWResize();
if(!oIFrame){
oIFrame=document.createElement("iframe");
if(this.isSecure&&Module.RESIZE_MONITOR_SECURE_URL&&YAHOO.env.ua.ie){
oIFrame.src=Module.RESIZE_MONITOR_SECURE_URL;}
if(!supportsCWResize){
sHTML=["<html><head><script ","type=\"text/javascript\">","window.onresize=function(){window.parent.","YAHOO.widget.Module.textResizeEvent.","fire();};<","\/script></head>","<body></body></html>"].join('');
oIFrame.src="data:text/html;charset=utf-8,"+encodeURIComponent(sHTML);}
oIFrame.id="_yuiResizeMonitor";
oIFrame.style.position="absolute";
oIFrame.style.visibility="hidden";
var db=document.body,
fc=db.firstChild;
if(fc){
db.insertBefore(oIFrame,fc);}else{
db.appendChild(oIFrame);}
oIFrame.style.width="10em";
oIFrame.style.height="10em";
oIFrame.style.top=(-1*oIFrame.offsetHeight)+"px";
oIFrame.style.left=(-1*oIFrame.offsetWidth)+"px";
oIFrame.style.borderWidth="0";
oIFrame.style.visibility="visible";
if(YAHOO.env.ua.webkit){
oDoc=oIFrame.contentWindow.document;
oDoc.open();
oDoc.close();}}
if(oIFrame&&oIFrame.contentWindow){
Module.textResizeEvent.subscribe(this.onDomResize,this,true);
if(!Module.textResizeInitialized){
if(supportsCWResize){
if(!Event.on(oIFrame.contentWindow,"resize",fireTextResize)){
Event.on(oIFrame,"resize",fireTextResize);}}
Module.textResizeInitialized=true;}
this.resizeMonitor=oIFrame;}}},
_supportsCWResize:function(){
var bSupported=true;
if(YAHOO.env.ua.gecko&&YAHOO.env.ua.gecko<=1.8){
bSupported=false;}
return bSupported;},
onDomResize:function(e,obj){
var nLeft=-1*this.resizeMonitor.offsetWidth,
nTop=-1*this.resizeMonitor.offsetHeight;
this.resizeMonitor.style.top=nTop+"px";
this.resizeMonitor.style.left=nLeft+"px";},
setHeader:function(headerContent){
var oHeader=this.header||(this.header=createHeader());
if(headerContent.nodeName){
oHeader.innerHTML="";
oHeader.appendChild(headerContent);}else{
oHeader.innerHTML=headerContent;}
this.changeHeaderEvent.fire(headerContent);
this.changeContentEvent.fire();},
appendToHeader:function(element){
var oHeader=this.header||(this.header=createHeader());
oHeader.appendChild(element);
this.changeHeaderEvent.fire(element);
this.changeContentEvent.fire();},
setBody:function(bodyContent){
var oBody=this.body||(this.body=createBody());
if(bodyContent.nodeName){
oBody.innerHTML="";
oBody.appendChild(bodyContent);}else{
oBody.innerHTML=bodyContent;}
this.changeBodyEvent.fire(bodyContent);
this.changeContentEvent.fire();},
appendToBody:function(element){
var oBody=this.body||(this.body=createBody());
oBody.appendChild(element);
this.changeBodyEvent.fire(element);
this.changeContentEvent.fire();},
setFooter:function(footerContent){
var oFooter=this.footer||(this.footer=createFooter());
if(footerContent.nodeName){
oFooter.innerHTML="";
oFooter.appendChild(footerContent);}else{
oFooter.innerHTML=footerContent;}
this.changeFooterEvent.fire(footerContent);
this.changeContentEvent.fire();},
appendToFooter:function(element){
var oFooter=this.footer||(this.footer=createFooter());
oFooter.appendChild(element);
this.changeFooterEvent.fire(element);
this.changeContentEvent.fire();},
render:function(appendToNode,moduleElement){
var me=this,
firstChild;
function appendTo(parentNode){
if(typeof parentNode=="string"){
parentNode=document.getElementById(parentNode);}
if(parentNode){
me._addToParent(parentNode,me.element);
me.appendEvent.fire();}}
this.beforeRenderEvent.fire();
if(!moduleElement){
moduleElement=this.element;}
if(appendToNode){
appendTo(appendToNode);}else{
if(!Dom.inDocument(this.element)){
return false;}}
if(this.header&&!Dom.inDocument(this.header)){
firstChild=moduleElement.firstChild;
if(firstChild){
moduleElement.insertBefore(this.header,firstChild);}else{
moduleElement.appendChild(this.header);}}
if(this.body&&!Dom.inDocument(this.body)){
if(this.footer&&Dom.isAncestor(this.moduleElement,this.footer)){
moduleElement.insertBefore(this.body,this.footer);}else{
moduleElement.appendChild(this.body);}}
if(this.footer&&!Dom.inDocument(this.footer)){
moduleElement.appendChild(this.footer);}
this.renderEvent.fire();
return true;},
destroy:function(){
var parent,
e;
if(this.element){
Event.purgeElement(this.element,true);
parent=this.element.parentNode;}
if(parent){
parent.removeChild(this.element);}
this.element=null;
this.header=null;
this.body=null;
this.footer=null;
Module.textResizeEvent.unsubscribe(this.onDomResize,this);
this.cfg.destroy();
this.cfg=null;
this.destroyEvent.fire();
for(e in this){
if(e instanceof CustomEvent){
e.unsubscribeAll();}}},
show:function(){
this.cfg.setProperty("visible",true);},
hide:function(){
this.cfg.setProperty("visible",false);},
configVisible:function(type,args,obj){
var visible=args[0];
if(visible){
this.beforeShowEvent.fire();
Dom.setStyle(this.element,"display","block");
this.showEvent.fire();}else{
this.beforeHideEvent.fire();
Dom.setStyle(this.element,"display","none");
this.hideEvent.fire();}},
configMonitorResize:function(type,args,obj){
var monitor=args[0];
if(monitor){
this.initResizeMonitor();}else{
Module.textResizeEvent.unsubscribe(this.onDomResize,this,true);
this.resizeMonitor=null;}},
_addToParent:function(parentNode,element){
if(!this.cfg.getProperty("appendtodocumentbody")&&parentNode===document.body&&parentNode.firstChild){
parentNode.insertBefore(element,parentNode.firstChild);}else{
parentNode.appendChild(element);}},
toString:function(){
return"Module "+this.id;}};
YAHOO.lang.augmentProto(Module,YAHOO.util.EventProvider);}());
(function(){
YAHOO.widget.Overlay=function(el,userConfig){
YAHOO.widget.Overlay.superclass.constructor.call(this,el,userConfig);};
var Lang=YAHOO.lang,
CustomEvent=YAHOO.util.CustomEvent,
Module=YAHOO.widget.Module,
Event=YAHOO.util.Event,
Dom=YAHOO.util.Dom,
Config=YAHOO.util.Config,
Overlay=YAHOO.widget.Overlay,
m_oIFrameTemplate,
EVENT_TYPES={"BEFORE_MOVE":"beforeMove","MOVE":"move"},
DEFAULT_CONFIG={"X":{
key:"x",
validator:Lang.isNumber,
suppressEvent:true,
supercedes:["iframe"]},"Y":{
key:"y",
validator:Lang.isNumber,
suppressEvent:true,
supercedes:["iframe"]},"XY":{
key:"xy",
suppressEvent:true,
supercedes:["iframe"]},"CONTEXT":{
key:"context",
suppressEvent:true,
supercedes:["iframe"]},"FIXED_CENTER":{
key:"fixedcenter",
value:false,
validator:Lang.isBoolean,
supercedes:["iframe","visible"]},"WIDTH":{
key:"width",
suppressEvent:true,
supercedes:["context","fixedcenter","iframe"]},"HEIGHT":{
key:"height",
suppressEvent:true,
supercedes:["context","fixedcenter","iframe"]},"ZINDEX":{
key:"zindex",
value:null},"CONSTRAIN_TO_VIEWPORT":{
key:"constraintoviewport",
value:false,
validator:Lang.isBoolean,
supercedes:["iframe","x","y","xy"]},"IFRAME":{
key:"iframe",
value:(YAHOO.env.ua.ie==6?true:false),
validator:Lang.isBoolean,
supercedes:["zindex"]}};
Overlay.IFRAME_SRC="javascript:false;";
Overlay.IFRAME_OFFSET=3;
Overlay.VIEWPORT_OFFSET=10;
Overlay.TOP_LEFT="tl";
Overlay.TOP_RIGHT="tr";
Overlay.BOTTOM_LEFT="bl";
Overlay.BOTTOM_RIGHT="br";
Overlay.CSS_OVERLAY="yui-overlay";
Overlay.windowScrollEvent=new CustomEvent("windowScroll");
Overlay.windowResizeEvent=new CustomEvent("windowResize");
Overlay.windowScrollHandler=function(e){
if(YAHOO.env.ua.ie){
if(!window.scrollEnd){
window.scrollEnd=-1;}
clearTimeout(window.scrollEnd);
window.scrollEnd=setTimeout(function(){
Overlay.windowScrollEvent.fire();},1);}else{
Overlay.windowScrollEvent.fire();}};
Overlay.windowResizeHandler=function(e){
if(YAHOO.env.ua.ie){
if(!window.resizeEnd){
window.resizeEnd=-1;}
clearTimeout(window.resizeEnd);
window.resizeEnd=setTimeout(function(){
Overlay.windowResizeEvent.fire();},100);}else{
Overlay.windowResizeEvent.fire();}};
Overlay._initialized=null;
if(Overlay._initialized===null){
Event.on(window,"scroll",Overlay.windowScrollHandler);
Event.on(window,"resize",Overlay.windowResizeHandler);
Overlay._initialized=true;}
YAHOO.extend(Overlay,Module,{
init:function(el,userConfig){
Overlay.superclass.init.call(this,el);
this.beforeInitEvent.fire(Overlay);
Dom.addClass(this.element,Overlay.CSS_OVERLAY);
if(userConfig){
this.cfg.applyConfig(userConfig,true);}
if(this.platform=="mac"&&YAHOO.env.ua.gecko){
if(!Config.alreadySubscribed(this.showEvent,
this.showMacGeckoScrollbars,this)){
this.showEvent.subscribe(this.showMacGeckoScrollbars,
this,true);}
if(!Config.alreadySubscribed(this.hideEvent,
this.hideMacGeckoScrollbars,this)){
this.hideEvent.subscribe(this.hideMacGeckoScrollbars,
this,true);}}
this.initEvent.fire(Overlay);},
initEvents:function(){
Overlay.superclass.initEvents.call(this);
var SIGNATURE=CustomEvent.LIST;
this.beforeMoveEvent=this.createEvent(EVENT_TYPES.BEFORE_MOVE);
this.beforeMoveEvent.signature=SIGNATURE;
this.moveEvent=this.createEvent(EVENT_TYPES.MOVE);
this.moveEvent.signature=SIGNATURE;},
initDefaultConfig:function(){
Overlay.superclass.initDefaultConfig.call(this);
this.cfg.addProperty(DEFAULT_CONFIG.X.key,{
handler:this.configX,
validator:DEFAULT_CONFIG.X.validator,
suppressEvent:DEFAULT_CONFIG.X.suppressEvent,
supercedes:DEFAULT_CONFIG.X.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.Y.key,{
handler:this.configY,
validator:DEFAULT_CONFIG.Y.validator,
suppressEvent:DEFAULT_CONFIG.Y.suppressEvent,
supercedes:DEFAULT_CONFIG.Y.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.XY.key,{
handler:this.configXY,
suppressEvent:DEFAULT_CONFIG.XY.suppressEvent,
supercedes:DEFAULT_CONFIG.XY.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.CONTEXT.key,{
handler:this.configContext,
suppressEvent:DEFAULT_CONFIG.CONTEXT.suppressEvent,
supercedes:DEFAULT_CONFIG.CONTEXT.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.FIXED_CENTER.key,{
handler:this.configFixedCenter,
value:DEFAULT_CONFIG.FIXED_CENTER.value,
validator:DEFAULT_CONFIG.FIXED_CENTER.validator,
supercedes:DEFAULT_CONFIG.FIXED_CENTER.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.WIDTH.key,{
handler:this.configWidth,
suppressEvent:DEFAULT_CONFIG.WIDTH.suppressEvent,
supercedes:DEFAULT_CONFIG.WIDTH.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.HEIGHT.key,{
handler:this.configHeight,
suppressEvent:DEFAULT_CONFIG.HEIGHT.suppressEvent,
supercedes:DEFAULT_CONFIG.HEIGHT.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.ZINDEX.key,{
handler:this.configzIndex,
value:DEFAULT_CONFIG.ZINDEX.value});
this.cfg.addProperty(DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,{
handler:this.configConstrainToViewport,
value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,
validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,
supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});
this.cfg.addProperty(DEFAULT_CONFIG.IFRAME.key,{
handler:this.configIframe,
value:DEFAULT_CONFIG.IFRAME.value,
validator:DEFAULT_CONFIG.IFRAME.validator,
supercedes:DEFAULT_CONFIG.IFRAME.supercedes});},
moveTo:function(x,y){
this.cfg.setProperty("xy",[x,y]);},
hideMacGeckoScrollbars:function(){
Dom.removeClass(this.element,"show-scrollbars");
Dom.addClass(this.element,"hide-scrollbars");},
showMacGeckoScrollbars:function(){
Dom.removeClass(this.element,"hide-scrollbars");
Dom.addClass(this.element,"show-scrollbars");},
configVisible:function(type,args,obj){
var visible=args[0],
currentVis=Dom.getStyle(this.element,"visibility"),
effect=this.cfg.getProperty("effect"),
effectInstances=[],
isMacGecko=(this.platform=="mac"&&YAHOO.env.ua.gecko),
alreadySubscribed=Config.alreadySubscribed,
eff,ei,e,i,j,k,h,
nEffects,
nEffectInstances;
if(currentVis=="inherit"){
e=this.element.parentNode;
while(e.nodeType!=9&&e.nodeType!=11){
currentVis=Dom.getStyle(e,"visibility");
if(currentVis!="inherit"){
break;}
e=e.parentNode;}
if(currentVis=="inherit"){
currentVis="visible";}}
if(effect){
if(effect instanceof Array){
nEffects=effect.length;
for(i=0;i<nEffects;i++){
eff=effect[i];
effectInstances[effectInstances.length]=
eff.effect(this,eff.duration);}}else{
effectInstances[effectInstances.length]=
effect.effect(this,effect.duration);}}
if(visible){
if(isMacGecko){
this.showMacGeckoScrollbars();}
if(effect){
if(visible){
if(currentVis!="visible"||currentVis===""){
this.beforeShowEvent.fire();
nEffectInstances=effectInstances.length;
for(j=0;j<nEffectInstances;j++){
ei=effectInstances[j];
if(j===0&&!alreadySubscribed(
ei.animateInCompleteEvent,
this.showEvent.fire,this.showEvent)){
ei.animateInCompleteEvent.subscribe(
this.showEvent.fire,this.showEvent,true);}
ei.animateIn();}}}}else{
if(currentVis!="visible"||currentVis===""){
this.beforeShowEvent.fire();
Dom.setStyle(this.element,"visibility","visible");
this.cfg.refireEvent("iframe");
this.showEvent.fire();}}}else{
if(isMacGecko){
this.hideMacGeckoScrollbars();}
if(effect){
if(currentVis=="visible"){
this.beforeHideEvent.fire();
nEffectInstances=effectInstances.length;
for(k=0;k<nEffectInstances;k++){
h=effectInstances[k];
if(k===0&&!alreadySubscribed(
h.animateOutCompleteEvent,this.hideEvent.fire,
this.hideEvent)){
h.animateOutCompleteEvent.subscribe(
this.hideEvent.fire,this.hideEvent,true);}
h.animateOut();}}else if(currentVis===""){
Dom.setStyle(this.element,"visibility","hidden");}}else{
if(currentVis=="visible"||currentVis===""){
this.beforeHideEvent.fire();
Dom.setStyle(this.element,"visibility","hidden");
this.hideEvent.fire();}}}},
doCenterOnDOMEvent:function(){
if(this.cfg.getProperty("visible")){
this.center();}},
configFixedCenter:function(type,args,obj){
var val=args[0],
alreadySubscribed=Config.alreadySubscribed,
windowResizeEvent=Overlay.windowResizeEvent,
windowScrollEvent=Overlay.windowScrollEvent;
if(val){
this.center();
if(!alreadySubscribed(this.beforeShowEvent,this.center,this)){
this.beforeShowEvent.subscribe(this.center);}
if(!alreadySubscribed(windowResizeEvent,this.doCenterOnDOMEvent,this)){
windowResizeEvent.subscribe(this.doCenterOnDOMEvent,this,true);}
if(!alreadySubscribed(windowScrollEvent,this.doCenterOnDOMEvent,this)){
windowScrollEvent.subscribe(this.doCenterOnDOMEvent,this,true);}}else{
this.beforeShowEvent.unsubscribe(this.center);
windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent,this);
windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent,this);}},
configHeight:function(type,args,obj){
var height=args[0],
el=this.element;
Dom.setStyle(el,"height",height);
this.cfg.refireEvent("iframe");},
configWidth:function(type,args,obj){
var width=args[0],
el=this.element;
Dom.setStyle(el,"width",width);
this.cfg.refireEvent("iframe");},
configzIndex:function(type,args,obj){
var zIndex=args[0],
el=this.element;
if(!zIndex){
zIndex=Dom.getStyle(el,"zIndex");
if(!zIndex||isNaN(zIndex)){
zIndex=0;}}
if(this.iframe||this.cfg.getProperty("iframe")===true){
if(zIndex<=0){
zIndex=1;}}
Dom.setStyle(el,"zIndex",zIndex);
this.cfg.setProperty("zIndex",zIndex,true);
if(this.iframe){
this.stackIframe();}},
configXY:function(type,args,obj){
var pos=args[0],
x=pos[0],
y=pos[1];
this.cfg.setProperty("x",x);
this.cfg.setProperty("y",y);
this.beforeMoveEvent.fire([x,y]);
x=this.cfg.getProperty("x");
y=this.cfg.getProperty("y");
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x,y]);},
configX:function(type,args,obj){
var x=args[0],
y=this.cfg.getProperty("y");
this.cfg.setProperty("x",x,true);
this.cfg.setProperty("y",y,true);
this.beforeMoveEvent.fire([x,y]);
x=this.cfg.getProperty("x");
y=this.cfg.getProperty("y");
Dom.setX(this.element,x,true);
this.cfg.setProperty("xy",[x,y],true);
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x,y]);},
configY:function(type,args,obj){
var x=this.cfg.getProperty("x"),
y=args[0];
this.cfg.setProperty("x",x,true);
this.cfg.setProperty("y",y,true);
this.beforeMoveEvent.fire([x,y]);
x=this.cfg.getProperty("x");
y=this.cfg.getProperty("y");
Dom.setY(this.element,y,true);
this.cfg.setProperty("xy",[x,y],true);
this.cfg.refireEvent("iframe");
this.moveEvent.fire([x,y]);},
showIframe:function(){
var oIFrame=this.iframe,
oParentNode;
if(oIFrame){
oParentNode=this.element.parentNode;
if(oParentNode!=oIFrame.parentNode){
this._addToParent(oParentNode,oIFrame);}
oIFrame.style.display="block";}},
hideIframe:function(){
if(this.iframe){
this.iframe.style.display="none";}},
syncIframe:function(){
var oIFrame=this.iframe,
oElement=this.element,
nOffset=Overlay.IFRAME_OFFSET,
nDimensionOffset=(nOffset*2),
aXY;
if(oIFrame){
oIFrame.style.width=(oElement.offsetWidth+nDimensionOffset+"px");
oIFrame.style.height=(oElement.offsetHeight+nDimensionOffset+"px");
aXY=this.cfg.getProperty("xy");
if(!Lang.isArray(aXY)||(isNaN(aXY[0])||isNaN(aXY[1]))){
this.syncPosition();
aXY=this.cfg.getProperty("xy");}
Dom.setXY(oIFrame,[(aXY[0]-nOffset),(aXY[1]-nOffset)]);}},
stackIframe:function(){
if(this.iframe){
var overlayZ=Dom.getStyle(this.element,"zIndex");
if(!YAHOO.lang.isUndefined(overlayZ)&&!isNaN(overlayZ)){
Dom.setStyle(this.iframe,"zIndex",(overlayZ-1));}}},
configIframe:function(type,args,obj){
var bIFrame=args[0];
function createIFrame(){
var oIFrame=this.iframe,
oElement=this.element,
oParent;
if(!oIFrame){
if(!m_oIFrameTemplate){
m_oIFrameTemplate=document.createElement("iframe");
if(this.isSecure){
m_oIFrameTemplate.src=Overlay.IFRAME_SRC;}
if(YAHOO.env.ua.ie){
m_oIFrameTemplate.style.filter="alpha(opacity=0)";
m_oIFrameTemplate.frameBorder=0;}
else{
m_oIFrameTemplate.style.opacity="0";}
m_oIFrameTemplate.style.position="absolute";
m_oIFrameTemplate.style.border="none";
m_oIFrameTemplate.style.margin="0";
m_oIFrameTemplate.style.padding="0";
m_oIFrameTemplate.style.display="none";}
oIFrame=m_oIFrameTemplate.cloneNode(false);
oParent=oElement.parentNode;
var parentNode=oParent||document.body;
this._addToParent(parentNode,oIFrame);
this.iframe=oIFrame;}
this.showIframe();
this.syncIframe();
this.stackIframe();
if(!this._hasIframeEventListeners){
this.showEvent.subscribe(this.showIframe);
this.hideEvent.subscribe(this.hideIframe);
this.changeContentEvent.subscribe(this.syncIframe);
this._hasIframeEventListeners=true;}}
function onBeforeShow(){
createIFrame.call(this);
this.beforeShowEvent.unsubscribe(onBeforeShow);
this._iframeDeferred=false;}
if(bIFrame){
if(this.cfg.getProperty("visible")){
createIFrame.call(this);}else{
if(!this._iframeDeferred){
this.beforeShowEvent.subscribe(onBeforeShow);
this._iframeDeferred=true;}}}else{
this.hideIframe();
if(this._hasIframeEventListeners){
this.showEvent.unsubscribe(this.showIframe);
this.hideEvent.unsubscribe(this.hideIframe);
this.changeContentEvent.unsubscribe(this.syncIframe);
this._hasIframeEventListeners=false;}}},
_primeXYFromDOM:function(){
if(YAHOO.lang.isUndefined(this.cfg.getProperty("xy"))){
this.syncPosition();
this.cfg.refireEvent("xy");
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);}},
configConstrainToViewport:function(type,args,obj){
var val=args[0];
if(val){
if(!Config.alreadySubscribed(this.beforeMoveEvent,this.enforceConstraints,this)){
this.beforeMoveEvent.subscribe(this.enforceConstraints,this,true);}
if(!Config.alreadySubscribed(this.beforeShowEvent,this._primeXYFromDOM)){
this.beforeShowEvent.subscribe(this._primeXYFromDOM);}}else{
this.beforeShowEvent.unsubscribe(this._primeXYFromDOM);
this.beforeMoveEvent.unsubscribe(this.enforceConstraints,this);}},
configContext:function(type,args,obj){
var contextArgs=args[0],
contextEl,
elementMagnetCorner,
contextMagnetCorner;
if(contextArgs){
contextEl=contextArgs[0];
elementMagnetCorner=contextArgs[1];
contextMagnetCorner=contextArgs[2];
if(contextEl){
if(typeof contextEl=="string"){
this.cfg.setProperty("context",
[document.getElementById(contextEl),
elementMagnetCorner,contextMagnetCorner],
true);}
if(elementMagnetCorner&&contextMagnetCorner){
this.align(elementMagnetCorner,contextMagnetCorner);}}}},
align:function(elementAlign,contextAlign){
var contextArgs=this.cfg.getProperty("context"),
me=this,
context,
element,
contextRegion;
function doAlign(v,h){
switch(elementAlign){
case Overlay.TOP_LEFT:
me.moveTo(h,v);
break;
case Overlay.TOP_RIGHT:
me.moveTo((h-element.offsetWidth),v);
break;
case Overlay.BOTTOM_LEFT:
me.moveTo(h,(v-element.offsetHeight));
break;
case Overlay.BOTTOM_RIGHT:
me.moveTo((h-element.offsetWidth),
(v-element.offsetHeight));
break;}}
if(contextArgs){
context=contextArgs[0];
element=this.element;
me=this;
if(!elementAlign){
elementAlign=contextArgs[1];}
if(!contextAlign){
contextAlign=contextArgs[2];}
if(element&&context){
contextRegion=Dom.getRegion(context);
switch(contextAlign){
case Overlay.TOP_LEFT:
doAlign(contextRegion.top,contextRegion.left);
break;
case Overlay.TOP_RIGHT:
doAlign(contextRegion.top,contextRegion.right);
break;
case Overlay.BOTTOM_LEFT:
doAlign(contextRegion.bottom,contextRegion.left);
break;
case Overlay.BOTTOM_RIGHT:
doAlign(contextRegion.bottom,contextRegion.right);
break;}}}},
enforceConstraints:function(type,args,obj){
var pos=args[0];
var cXY=this.getConstrainedXY(pos[0],pos[1]);
this.cfg.setProperty("x",cXY[0],true);
this.cfg.setProperty("y",cXY[1],true);
this.cfg.setProperty("xy",cXY,true);},
getConstrainedXY:function(x,y){
var nViewportOffset=Overlay.VIEWPORT_OFFSET,
viewPortWidth=Dom.getViewportWidth(),
viewPortHeight=Dom.getViewportHeight(),
offsetHeight=this.element.offsetHeight,
offsetWidth=this.element.offsetWidth,
scrollX=Dom.getDocumentScrollLeft(),
scrollY=Dom.getDocumentScrollTop();
var xNew=x;
var yNew=y;
if(offsetWidth+nViewportOffset<viewPortWidth){
var leftConstraint=scrollX+nViewportOffset;
var rightConstraint=scrollX+viewPortWidth-offsetWidth-nViewportOffset;
if(x<leftConstraint){
xNew=leftConstraint;}else if(x>rightConstraint){
xNew=rightConstraint;}}else{
xNew=nViewportOffset+scrollX;}
if(offsetHeight+nViewportOffset<viewPortHeight){
var topConstraint=scrollY+nViewportOffset;
var bottomConstraint=scrollY+viewPortHeight-offsetHeight-nViewportOffset;
if(y<topConstraint){
yNew=topConstraint;}else if(y>bottomConstraint){
yNew=bottomConstraint;}}else{
yNew=nViewportOffset+scrollY;}
return[xNew,yNew];},
center:function(){
var nViewportOffset=Overlay.VIEWPORT_OFFSET,
elementWidth=this.element.offsetWidth,
elementHeight=this.element.offsetHeight,
viewPortWidth=Dom.getViewportWidth(),
viewPortHeight=Dom.getViewportHeight(),
x,
y;
if(elementWidth<viewPortWidth){
x=(viewPortWidth/2)-(elementWidth/2)+Dom.getDocumentScrollLeft();}else{
x=nViewportOffset+Dom.getDocumentScrollLeft();}
if(elementHeight<viewPortHeight){
y=(viewPortHeight/2)-(elementHeight/2)+Dom.getDocumentScrollTop();}else{
y=nViewportOffset+Dom.getDocumentScrollTop();}
this.cfg.setProperty("xy",[parseInt(x,10),parseInt(y,10)]);
this.cfg.refireEvent("iframe");},
syncPosition:function(){
var pos=Dom.getXY(this.element);
this.cfg.setProperty("x",pos[0],true);
this.cfg.setProperty("y",pos[1],true);
this.cfg.setProperty("xy",pos,true);},
onDomResize:function(e,obj){
var me=this;
Overlay.superclass.onDomResize.call(this,e,obj);
setTimeout(function(){
me.syncPosition();
me.cfg.refireEvent("iframe");
me.cfg.refireEvent("context");},0);},
bringToTop:function(){
var aOverlays=[],
oElement=this.element;
function compareZIndexDesc(p_oOverlay1,p_oOverlay2){
var sZIndex1=Dom.getStyle(p_oOverlay1,"zIndex"),
sZIndex2=Dom.getStyle(p_oOverlay2,"zIndex"),
nZIndex1=(!sZIndex1||isNaN(sZIndex1))?0:parseInt(sZIndex1,10),
nZIndex2=(!sZIndex2||isNaN(sZIndex2))?0:parseInt(sZIndex2,10);
if(nZIndex1>nZIndex2){
return-1;}else if(nZIndex1<nZIndex2){
return 1;}else{
return 0;}}
function isOverlayElement(p_oElement){
var oOverlay=Dom.hasClass(p_oElement,Overlay.CSS_OVERLAY),
Panel=YAHOO.widget.Panel;
if(oOverlay&&!Dom.isAncestor(oElement,oOverlay)){
if(Panel&&Dom.hasClass(p_oElement,Panel.CSS_PANEL)){
aOverlays[aOverlays.length]=p_oElement.parentNode;}else{
aOverlays[aOverlays.length]=p_oElement;}}}
Dom.getElementsBy(isOverlayElement,"DIV",document.body);
aOverlays.sort(compareZIndexDesc);
var oTopOverlay=aOverlays[0],
nTopZIndex;
if(oTopOverlay){
nTopZIndex=Dom.getStyle(oTopOverlay,"zIndex");
if(!isNaN(nTopZIndex)){
var bRequiresBump=false;
if(oTopOverlay!=oElement){
bRequiresBump=true;}else if(aOverlays.length>1){
var nNextZIndex=Dom.getStyle(aOverlays[1],"zIndex");
if(!isNaN(nNextZIndex)&&(nTopZIndex==nNextZIndex)){
bRequiresBump=true;}}
if(bRequiresBump){
this.cfg.setProperty("zindex",(parseInt(nTopZIndex,10)+2));}}}},
destroy:function(){
if(this.iframe){
this.iframe.parentNode.removeChild(this.iframe);}
this.iframe=null;
Overlay.windowResizeEvent.unsubscribe(
this.doCenterOnDOMEvent,this);
Overlay.windowScrollEvent.unsubscribe(
this.doCenterOnDOMEvent,this);
Overlay.superclass.destroy.call(this);},
toString:function(){
return"Overlay "+this.id;}});}());
(function(){
YAHOO.widget.OverlayManager=function(userConfig){
this.init(userConfig);};
var Overlay=YAHOO.widget.Overlay,
Event=YAHOO.util.Event,
Dom=YAHOO.util.Dom,
Config=YAHOO.util.Config,
CustomEvent=YAHOO.util.CustomEvent,
OverlayManager=YAHOO.widget.OverlayManager;
OverlayManager.CSS_FOCUSED="focused";
OverlayManager.prototype={
constructor:OverlayManager,
overlays:null,
initDefaultConfig:function(){
this.cfg.addProperty("overlays",{suppressEvent:true});
this.cfg.addProperty("focusevent",{value:"mousedown"});},
init:function(userConfig){
this.cfg=new Config(this);
this.initDefaultConfig();
if(userConfig){
this.cfg.applyConfig(userConfig,true);}
this.cfg.fireQueue();
var activeOverlay=null;
this.getActive=function(){
return activeOverlay;};
this.focus=function(overlay){
var o=this.find(overlay);
if(o){
if(activeOverlay!=o){
if(activeOverlay){
activeOverlay.blur();}
this.bringToTop(o);
activeOverlay=o;
Dom.addClass(activeOverlay.element,
OverlayManager.CSS_FOCUSED);
o.focusEvent.fire();}}};
this.remove=function(overlay){
var o=this.find(overlay),
originalZ;
if(o){
if(activeOverlay==o){
activeOverlay=null;}
var bDestroyed=(o.element===null&&o.cfg===null)?true:false;
if(!bDestroyed){
originalZ=Dom.getStyle(o.element,"zIndex");
o.cfg.setProperty("zIndex",-1000,true);}
this.overlays.sort(this.compareZIndexDesc);
this.overlays=this.overlays.slice(0,(this.overlays.length-1));
o.hideEvent.unsubscribe(o.blur);
o.destroyEvent.unsubscribe(this._onOverlayDestroy,o);
if(!bDestroyed){
Event.removeListener(o.element,
this.cfg.getProperty("focusevent"),
this._onOverlayElementFocus);
o.cfg.setProperty("zIndex",originalZ,true);
o.cfg.setProperty("manager",null);}
o.focusEvent.unsubscribeAll();
o.blurEvent.unsubscribeAll();
o.focusEvent=null;
o.blurEvent=null;
o.focus=null;
o.blur=null;}};
this.blurAll=function(){
var nOverlays=this.overlays.length,
i;
if(nOverlays>0){
i=nOverlays-1;
do{
this.overlays[i].blur();}
while(i--);}};
this._onOverlayBlur=function(p_sType,p_aArgs){
activeOverlay=null;};
var overlays=this.cfg.getProperty("overlays");
if(!this.overlays){
this.overlays=[];}
if(overlays){
this.register(overlays);
this.overlays.sort(this.compareZIndexDesc);}},
_onOverlayElementFocus:function(p_oEvent){
var oTarget=Event.getTarget(p_oEvent),
oClose=this.close;
if(oClose&&(oTarget==oClose||Dom.isAncestor(oClose,oTarget))){
this.blur();}else{
this.focus();}},
_onOverlayDestroy:function(p_sType,p_aArgs,p_oOverlay){
this.remove(p_oOverlay);},
register:function(overlay){
var mgr=this,
zIndex,
regcount,
i,
nOverlays;
if(overlay instanceof Overlay){
overlay.cfg.addProperty("manager",{value:this});
overlay.focusEvent=overlay.createEvent("focus");
overlay.focusEvent.signature=CustomEvent.LIST;
overlay.blurEvent=overlay.createEvent("blur");
overlay.blurEvent.signature=CustomEvent.LIST;
overlay.focus=function(){
mgr.focus(this);};
overlay.blur=function(){
if(mgr.getActive()==this){
Dom.removeClass(this.element,OverlayManager.CSS_FOCUSED);
this.blurEvent.fire();}};
overlay.blurEvent.subscribe(mgr._onOverlayBlur);
overlay.hideEvent.subscribe(overlay.blur);
overlay.destroyEvent.subscribe(this._onOverlayDestroy,overlay,this);
Event.on(overlay.element,this.cfg.getProperty("focusevent"),
this._onOverlayElementFocus,null,overlay);
zIndex=Dom.getStyle(overlay.element,"zIndex");
if(!isNaN(zIndex)){
overlay.cfg.setProperty("zIndex",parseInt(zIndex,10));}else{
overlay.cfg.setProperty("zIndex",0);}
this.overlays.push(overlay);
this.bringToTop(overlay);
return true;}else if(overlay instanceof Array){
regcount=0;
nOverlays=overlay.length;
for(i=0;i<nOverlays;i++){
if(this.register(overlay[i])){
regcount++;}}
if(regcount>0){
return true;}}else{
return false;}},
bringToTop:function(p_oOverlay){
var oOverlay=this.find(p_oOverlay),
nTopZIndex,
oTopOverlay,
aOverlays;
if(oOverlay){
aOverlays=this.overlays;
aOverlays.sort(this.compareZIndexDesc);
oTopOverlay=aOverlays[0];
if(oTopOverlay){
nTopZIndex=Dom.getStyle(oTopOverlay.element,"zIndex");
if(!isNaN(nTopZIndex)){
var bRequiresBump=false;
if(oTopOverlay!==oOverlay){
bRequiresBump=true;}else if(aOverlays.length>1){
var nNextZIndex=Dom.getStyle(aOverlays[1].element,"zIndex");
if(!isNaN(nNextZIndex)&&(nTopZIndex==nNextZIndex)){
bRequiresBump=true;}}
if(bRequiresBump){
oOverlay.cfg.setProperty("zindex",(parseInt(nTopZIndex,10)+2));}}
aOverlays.sort(this.compareZIndexDesc);}}},
find:function(overlay){
var aOverlays=this.overlays,
nOverlays=aOverlays.length,
i;
if(nOverlays>0){
i=nOverlays-1;
if(overlay instanceof Overlay){
do{
if(aOverlays[i]==overlay){
return aOverlays[i];}}
while(i--);}else if(typeof overlay=="string"){
do{
if(aOverlays[i].id==overlay){
return aOverlays[i];}}
while(i--);}
return null;}},
compareZIndexDesc:function(o1,o2){
var zIndex1=(o1.cfg)?o1.cfg.getProperty("zIndex"):null,
zIndex2=(o2.cfg)?o2.cfg.getProperty("zIndex"):null;
if(zIndex1===null&&zIndex2===null){
return 0;}else if(zIndex1===null){
return 1;}else if(zIndex2===null){
return-1;}else if(zIndex1>zIndex2){
return-1;}else if(zIndex1<zIndex2){
return 1;}else{
return 0;}},
showAll:function(){
var aOverlays=this.overlays,
nOverlays=aOverlays.length,
i;
if(nOverlays>0){
i=nOverlays-1;
do{
aOverlays[i].show();}
while(i--);}},
hideAll:function(){
var aOverlays=this.overlays,
nOverlays=aOverlays.length,
i;
if(nOverlays>0){
i=nOverlays-1;
do{
aOverlays[i].hide();}
while(i--);}},
toString:function(){
return"OverlayManager";}};}());
(function(){
YAHOO.widget.ContainerEffect=
function(overlay,attrIn,attrOut,targetElement,animClass){
if(!animClass){
animClass=YAHOO.util.Anim;}
this.overlay=overlay;
this.attrIn=attrIn;
this.attrOut=attrOut;
this.targetElement=targetElement||overlay.element;
this.animClass=animClass;};
var Dom=YAHOO.util.Dom,
CustomEvent=YAHOO.util.CustomEvent,
Easing=YAHOO.util.Easing,
ContainerEffect=YAHOO.widget.ContainerEffect;
ContainerEffect.FADE=function(overlay,dur){
var fin={
attributes:{opacity:{from:0,to:1}},
duration:dur,
method:Easing.easeIn};
var fout={
attributes:{opacity:{to:0}},
duration:dur,
method:Easing.easeOut};
var fade=new ContainerEffect(overlay,fin,fout,overlay.element);
fade.handleUnderlayStart=function(){
var underlay=this.overlay.underlay;
if(underlay&&YAHOO.env.ua.ie){
var hasFilters=(underlay.filters&&underlay.filters.length>0);
if(hasFilters){
Dom.addClass(overlay.element,"yui-effect-fade");}}};
fade.handleUnderlayComplete=function(){
var underlay=this.overlay.underlay;
if(underlay&&YAHOO.env.ua.ie){
Dom.removeClass(overlay.element,"yui-effect-fade");}};
fade.handleStartAnimateIn=function(type,args,obj){
Dom.addClass(obj.overlay.element,"hide-select");
if(!obj.overlay.underlay){
obj.overlay.cfg.refireEvent("underlay");}
obj.handleUnderlayStart();
Dom.setStyle(obj.overlay.element,"visibility","visible");
Dom.setStyle(obj.overlay.element,"opacity",0);};
fade.handleCompleteAnimateIn=function(type,args,obj){
Dom.removeClass(obj.overlay.element,"hide-select");
if(obj.overlay.element.style.filter){
obj.overlay.element.style.filter=null;}
obj.handleUnderlayComplete();
obj.overlay.cfg.refireEvent("iframe");
obj.animateInCompleteEvent.fire();};
fade.handleStartAnimateOut=function(type,args,obj){
Dom.addClass(obj.overlay.element,"hide-select");
obj.handleUnderlayStart();};
fade.handleCompleteAnimateOut=function(type,args,obj){
Dom.removeClass(obj.overlay.element,"hide-select");
if(obj.overlay.element.style.filter){
obj.overlay.element.style.filter=null;}
Dom.setStyle(obj.overlay.element,"visibility","hidden");
Dom.setStyle(obj.overlay.element,"opacity",1);
obj.handleUnderlayComplete();
obj.overlay.cfg.refireEvent("iframe");
obj.animateOutCompleteEvent.fire();};
fade.init();
return fade;};
ContainerEffect.SLIDE=function(overlay,dur){
var x=overlay.cfg.getProperty("x")||Dom.getX(overlay.element),
y=overlay.cfg.getProperty("y")||Dom.getY(overlay.element),
clientWidth=Dom.getClientWidth(),
offsetWidth=overlay.element.offsetWidth,
slide=new ContainerEffect(overlay,
{attributes:{points:{to:[x,y]}},
duration:dur,
method:Easing.easeIn},
{attributes:{points:{to:[(clientWidth+25),y]}},
duration:dur,
method:Easing.easeOut},
overlay.element,YAHOO.util.Motion);
slide.handleStartAnimateIn=function(type,args,obj){
obj.overlay.element.style.left=((-25)-offsetWidth)+"px";
obj.overlay.element.style.top=y+"px";};
slide.handleTweenAnimateIn=function(type,args,obj){
var pos=Dom.getXY(obj.overlay.element),
currentX=pos[0],
currentY=pos[1];
if(Dom.getStyle(obj.overlay.element,"visibility")=="hidden"&&currentX<x){
Dom.setStyle(obj.overlay.element,"visibility","visible");}
obj.overlay.cfg.setProperty("xy",[currentX,currentY],true);
obj.overlay.cfg.refireEvent("iframe");};
slide.handleCompleteAnimateIn=function(type,args,obj){
obj.overlay.cfg.setProperty("xy",[x,y],true);
obj.startX=x;
obj.startY=y;
obj.overlay.cfg.refireEvent("iframe");
obj.animateInCompleteEvent.fire();};
slide.handleStartAnimateOut=function(type,args,obj){
var vw=Dom.getViewportWidth(),
pos=Dom.getXY(obj.overlay.element),
yso=pos[1];
obj.animOut.attributes.points.to=[(vw+25),yso];};
slide.handleTweenAnimateOut=function(type,args,obj){
var pos=Dom.getXY(obj.overlay.element),
xto=pos[0],
yto=pos[1];
obj.overlay.cfg.setProperty("xy",[xto,yto],true);
obj.overlay.cfg.refireEvent("iframe");};
slide.handleCompleteAnimateOut=function(type,args,obj){
Dom.setStyle(obj.overlay.element,"visibility","hidden");
obj.overlay.cfg.setProperty("xy",[x,y]);
obj.animateOutCompleteEvent.fire();};
slide.init();
return slide;};
ContainerEffect.prototype={
init:function(){
this.beforeAnimateInEvent=this.createEvent("beforeAnimateIn");
this.beforeAnimateInEvent.signature=CustomEvent.LIST;
this.beforeAnimateOutEvent=this.createEvent("beforeAnimateOut");
this.beforeAnimateOutEvent.signature=CustomEvent.LIST;
this.animateInCompleteEvent=this.createEvent("animateInComplete");
this.animateInCompleteEvent.signature=CustomEvent.LIST;
this.animateOutCompleteEvent=
this.createEvent("animateOutComplete");
this.animateOutCompleteEvent.signature=CustomEvent.LIST;
this.animIn=new this.animClass(this.targetElement,
this.attrIn.attributes,this.attrIn.duration,
this.attrIn.method);
this.animIn.onStart.subscribe(this.handleStartAnimateIn,this);
this.animIn.onTween.subscribe(this.handleTweenAnimateIn,this);
this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn,
this);
this.animOut=new this.animClass(this.targetElement,
this.attrOut.attributes,this.attrOut.duration,
this.attrOut.method);
this.animOut.onStart.subscribe(this.handleStartAnimateOut,this);
this.animOut.onTween.subscribe(this.handleTweenAnimateOut,this);
this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut,
this);},
animateIn:function(){
this.beforeAnimateInEvent.fire();
this.animIn.animate();},
animateOut:function(){
this.beforeAnimateOutEvent.fire();
this.animOut.animate();},
handleStartAnimateIn:function(type,args,obj){},
handleTweenAnimateIn:function(type,args,obj){},
handleCompleteAnimateIn:function(type,args,obj){},
handleStartAnimateOut:function(type,args,obj){},
handleTweenAnimateOut:function(type,args,obj){},
handleCompleteAnimateOut:function(type,args,obj){},
toString:function(){
var output="ContainerEffect";
if(this.overlay){
output+=" ["+this.overlay.toString()+"]";}
return output;}};
YAHOO.lang.augmentProto(ContainerEffect,YAHOO.util.EventProvider);})();
YAHOO.register("containercore",YAHOO.widget.Module,{version:"2.5.1",build:"984"});
(function(){
var Dom=YAHOO.util.Dom,
Event=YAHOO.util.Event;
YAHOO.widget.MenuManager=function(){
var m_bInitializedEventHandlers=false,
m_oMenus={},
m_oVisibleMenus={},
m_oItems={},
m_oEventTypes={"click":"clickEvent","mousedown":"mouseDownEvent","mouseup":"mouseUpEvent","mouseover":"mouseOverEvent","mouseout":"mouseOutEvent","keydown":"keyDownEvent","keyup":"keyUpEvent","keypress":"keyPressEvent"},
m_oFocusedMenuItem=null;
function getMenuRootElement(p_oElement){
var oParentNode;
if(p_oElement&&p_oElement.tagName){
switch(p_oElement.tagName.toUpperCase()){
case"DIV":
oParentNode=p_oElement.parentNode;
if(
(
Dom.hasClass(p_oElement,"hd")||
Dom.hasClass(p_oElement,"bd")||
Dom.hasClass(p_oElement,"ft"))&&
oParentNode&&
oParentNode.tagName&&
oParentNode.tagName.toUpperCase()=="DIV")
{
return oParentNode;}
else{
return p_oElement;}
break;
case"LI":
return p_oElement;
default:
oParentNode=p_oElement.parentNode;
if(oParentNode){
return getMenuRootElement(oParentNode);}
break;}}}
function onDOMEvent(p_oEvent){
var oTarget=Event.getTarget(p_oEvent),
oElement=getMenuRootElement(oTarget),
sCustomEventType,
sTagName,
sId,
oMenuItem,
oMenu;
if(oElement){
sTagName=oElement.tagName.toUpperCase();
if(sTagName=="LI"){
sId=oElement.id;
if(sId&&m_oItems[sId]){
oMenuItem=m_oItems[sId];
oMenu=oMenuItem.parent;}}
else if(sTagName=="DIV"){
if(oElement.id){
oMenu=m_oMenus[oElement.id];}}}
if(oMenu){
sCustomEventType=m_oEventTypes[p_oEvent.type];
if(oMenuItem&&!oMenuItem.cfg.getProperty("disabled")){
oMenuItem[sCustomEventType].fire(p_oEvent);
if(
p_oEvent.type=="keyup"||
p_oEvent.type=="mousedown")
{
if(m_oFocusedMenuItem!=oMenuItem){
if(m_oFocusedMenuItem){
m_oFocusedMenuItem.blurEvent.fire();}
oMenuItem.focusEvent.fire();}}}
oMenu[sCustomEventType].fire(p_oEvent,oMenuItem);}
else if(p_oEvent.type=="mousedown"){
if(m_oFocusedMenuItem){
m_oFocusedMenuItem.blurEvent.fire();
m_oFocusedMenuItem=null;}
for(var i in m_oVisibleMenus){
if(YAHOO.lang.hasOwnProperty(m_oVisibleMenus,i)){
oMenu=m_oVisibleMenus[i];
if(oMenu.cfg.getProperty("clicktohide")&&!(oMenu instanceof YAHOO.widget.MenuBar)&&
oMenu.cfg.getProperty("position")=="dynamic"){
oMenu.hide();}
else{
oMenu.clearActiveItem(true);}}}}
else if(p_oEvent.type=="keyup"){
if(m_oFocusedMenuItem){
m_oFocusedMenuItem.blurEvent.fire();
m_oFocusedMenuItem=null;}}}
function onMenuDestroy(p_sType,p_aArgs,p_oMenu){
if(m_oMenus[p_oMenu.id]){
this.removeMenu(p_oMenu);}}
function onMenuFocus(p_sType,p_aArgs){
var oItem=p_aArgs[0];
if(oItem){
m_oFocusedMenuItem=oItem;}}
function onMenuBlur(p_sType,p_aArgs){
m_oFocusedMenuItem=null;}
function onMenuVisibleConfigChange(p_sType,p_aArgs){
var bVisible=p_aArgs[0],
sId=this.id;
if(bVisible){
m_oVisibleMenus[sId]=this;}
else if(m_oVisibleMenus[sId]){
delete m_oVisibleMenus[sId];}}
function onItemDestroy(p_sType,p_aArgs){
removeItem(this);}
function removeItem(p_oMenuItem){
var sId=p_oMenuItem.id;
if(sId&&m_oItems[sId]){
if(m_oFocusedMenuItem==p_oMenuItem){
m_oFocusedMenuItem=null;}
delete m_oItems[sId];
p_oMenuItem.destroyEvent.unsubscribe(onItemDestroy);}}
function onItemAdded(p_sType,p_aArgs){
var oItem=p_aArgs[0],
sId;
if(oItem instanceof YAHOO.widget.MenuItem){
sId=oItem.id;
if(!m_oItems[sId]){
m_oItems[sId]=oItem;
oItem.destroyEvent.subscribe(onItemDestroy);}}}
return{
addMenu:function(p_oMenu){
var oDoc;
if(p_oMenu instanceof YAHOO.widget.Menu&&p_oMenu.id&&!m_oMenus[p_oMenu.id]){
m_oMenus[p_oMenu.id]=p_oMenu;
if(!m_bInitializedEventHandlers){
oDoc=document;
Event.on(oDoc,"mouseover",onDOMEvent,this,true);
Event.on(oDoc,"mouseout",onDOMEvent,this,true);
Event.on(oDoc,"mousedown",onDOMEvent,this,true);
Event.on(oDoc,"mouseup",onDOMEvent,this,true);
Event.on(oDoc,"click",onDOMEvent,this,true);
Event.on(oDoc,"keydown",onDOMEvent,this,true);
Event.on(oDoc,"keyup",onDOMEvent,this,true);
Event.on(oDoc,"keypress",onDOMEvent,this,true);
m_bInitializedEventHandlers=true;}
p_oMenu.cfg.subscribeToConfigEvent("visible",
onMenuVisibleConfigChange);
p_oMenu.destroyEvent.subscribe(onMenuDestroy,p_oMenu,
this);
p_oMenu.itemAddedEvent.subscribe(onItemAdded);
p_oMenu.focusEvent.subscribe(onMenuFocus);
p_oMenu.blurEvent.subscribe(onMenuBlur);}},
removeMenu:function(p_oMenu){
var sId,
aItems,
i;
if(p_oMenu){
sId=p_oMenu.id;
if(m_oMenus[sId]==p_oMenu){
aItems=p_oMenu.getItems();
if(aItems&&aItems.length>0){
i=aItems.length-1;
do{
removeItem(aItems[i]);}
while(i--);}
delete m_oMenus[sId];
if(m_oVisibleMenus[sId]==p_oMenu){
delete m_oVisibleMenus[sId];}
if(p_oMenu.cfg){
p_oMenu.cfg.unsubscribeFromConfigEvent("visible",
onMenuVisibleConfigChange);}
p_oMenu.destroyEvent.unsubscribe(onMenuDestroy,
p_oMenu);
p_oMenu.itemAddedEvent.unsubscribe(onItemAdded);
p_oMenu.focusEvent.unsubscribe(onMenuFocus);
p_oMenu.blurEvent.unsubscribe(onMenuBlur);}}},
hideVisible:function(){
var oMenu;
for(var i in m_oVisibleMenus){
if(YAHOO.lang.hasOwnProperty(m_oVisibleMenus,i)){
oMenu=m_oVisibleMenus[i];
if(!(oMenu instanceof YAHOO.widget.MenuBar)&&
oMenu.cfg.getProperty("position")=="dynamic"){
oMenu.hide();}}}},
getVisible:function(){
return m_oVisibleMenus;},
getMenus:function(){
return m_oMenus;},
getMenu:function(p_sId){
var oMenu=m_oMenus[p_sId];
if(oMenu){
return oMenu;}},
getMenuItem:function(p_sId){
var oItem=m_oItems[p_sId];
if(oItem){
return oItem;}},
getMenuItemGroup:function(p_sId){
var oUL=Dom.get(p_sId),
aItems,
oNode,
oItem,
sId;
if(oUL&&oUL.tagName&&
oUL.tagName.toUpperCase()=="UL"){
oNode=oUL.firstChild;
if(oNode){
aItems=[];
do{
sId=oNode.id;
if(sId){
oItem=this.getMenuItem(sId);
if(oItem){
aItems[aItems.length]=oItem;}}}
while((oNode=oNode.nextSibling));
if(aItems.length>0){
return aItems;}}}},
getFocusedMenuItem:function(){
return m_oFocusedMenuItem;},
getFocusedMenu:function(){
if(m_oFocusedMenuItem){
return(m_oFocusedMenuItem.parent.getRoot());}},
toString:function(){
return"MenuManager";}};}();})();
(function(){
YAHOO.widget.Menu=function(p_oElement,p_oConfig){
if(p_oConfig){
this.parent=p_oConfig.parent;
this.lazyLoad=p_oConfig.lazyLoad||p_oConfig.lazyload;
this.itemData=p_oConfig.itemData||p_oConfig.itemdata;}
YAHOO.widget.Menu.superclass.constructor.call(this,p_oElement,p_oConfig);};
function checkPosition(p_sPosition){
if(typeof p_sPosition=="string"){
return("dynamic,static".indexOf((p_sPosition.toLowerCase()))!=-1);}}
var Dom=YAHOO.util.Dom,
Event=YAHOO.util.Event,
Module=YAHOO.widget.Module,
Overlay=YAHOO.widget.Overlay,
Menu=YAHOO.widget.Menu,
MenuManager=YAHOO.widget.MenuManager,
CustomEvent=YAHOO.util.CustomEvent,
Lang=YAHOO.lang,
UA=YAHOO.env.ua,
m_oShadowTemplate,
EVENT_TYPES={"MOUSE_OVER":"mouseover","MOUSE_OUT":"mouseout","MOUSE_DOWN":"mousedown","MOUSE_UP":"mouseup","CLICK":"click","KEY_PRESS":"keypress","KEY_DOWN":"keydown","KEY_UP":"keyup","FOCUS":"focus","BLUR":"blur","ITEM_ADDED":"itemAdded","ITEM_REMOVED":"itemRemoved"},
DEFAULT_CONFIG={"VISIBLE":{
key:"visible",
value:false,
validator:Lang.isBoolean},"CONSTRAIN_TO_VIEWPORT":{
key:"constraintoviewport",
value:true,
validator:Lang.isBoolean,
supercedes:["iframe","x","y","xy"]},"POSITION":{
key:"position",
value:"dynamic",
validator:checkPosition,
supercedes:["visible","iframe"]},"SUBMENU_ALIGNMENT":{
key:"submenualignment",
value:["tl","tr"],
suppressEvent:true},"AUTO_SUBMENU_DISPLAY":{
key:"autosubmenudisplay",
value:true,
validator:Lang.isBoolean,
suppressEvent:true},"SHOW_DELAY":{
key:"showdelay",
value:250,
validator:Lang.isNumber,
suppressEvent:true},"HIDE_DELAY":{
key:"hidedelay",
value:0,
validator:Lang.isNumber,
suppressEvent:true},"SUBMENU_HIDE_DELAY":{
key:"submenuhidedelay",
value:250,
validator:Lang.isNumber,
suppressEvent:true},"CLICK_TO_HIDE":{
key:"clicktohide",
value:true,
validator:Lang.isBoolean,
suppressEvent:true},"CONTAINER":{
key:"container",
suppressEvent:true},"SCROLL_INCREMENT":{
key:"scrollincrement",
value:1,
validator:Lang.isNumber,
supercedes:["maxheight"],
suppressEvent:true},"MIN_SCROLL_HEIGHT":{
key:"minscrollheight",
value:90,
validator:Lang.isNumber,
supercedes:["maxheight"],
suppressEvent:true},"MAX_HEIGHT":{
key:"maxheight",
value:0,
validator:Lang.isNumber,
supercedes:["iframe"],
suppressEvent:true},"CLASS_NAME":{
key:"classname",
value:null,
validator:Lang.isString,
suppressEvent:true},"DISABLED":{
key:"disabled",
value:false,
validator:Lang.isBoolean,
suppressEvent:true}};
YAHOO.lang.extend(Menu,Overlay,{
CSS_CLASS_NAME:"yuimenu",
ITEM_TYPE:null,
GROUP_TITLE_TAG_NAME:"h6",
OFF_SCREEN_POSITION:[-10000,-10000],
_nHideDelayId:null,
_nShowDelayId:null,
_nSubmenuHideDelayId:null,
_nBodyScrollId:null,
_bHideDelayEventHandlersAssigned:false,
_bHandledMouseOverEvent:false,
_bHandledMouseOutEvent:false,
_aGroupTitleElements:null,
_aItemGroups:null,
_aListElements:null,
_nCurrentMouseX:0,
_bStopMouseEventHandlers:false,
_sClassName:null,
lazyLoad:false,
itemData:null,
activeItem:null,
parent:null,
srcElement:null,
mouseOverEvent:null,
mouseOutEvent:null,
mouseDownEvent:null,
mouseUpEvent:null,
clickEvent:null,
keyPressEvent:null,
keyDownEvent:null,
keyUpEvent:null,
itemAddedEvent:null,
itemRemovedEvent:null,
init:function(p_oElement,p_oConfig){
this._aItemGroups=[];
this._aListElements=[];
this._aGroupTitleElements=[];
if(!this.ITEM_TYPE){
this.ITEM_TYPE=YAHOO.widget.MenuItem;}
var oElement;
if(typeof p_oElement=="string"){
oElement=document.getElementById(p_oElement);}
else if(p_oElement.tagName){
oElement=p_oElement;}
if(oElement&&oElement.tagName){
switch(oElement.tagName.toUpperCase()){
case"DIV":
this.srcElement=oElement;
if(!oElement.id){
oElement.setAttribute("id",Dom.generateId());}
Menu.superclass.init.call(this,oElement);
this.beforeInitEvent.fire(Menu);
break;
case"SELECT":
this.srcElement=oElement;
Menu.superclass.init.call(this,Dom.generateId());
this.beforeInitEvent.fire(Menu);
break;}}
else{
Menu.superclass.init.call(this,p_oElement);
this.beforeInitEvent.fire(Menu);}
if(this.element){
Dom.addClass(this.element,this.CSS_CLASS_NAME);
this.initEvent.subscribe(this._onInit);
this.beforeRenderEvent.subscribe(this._onBeforeRender);
this.renderEvent.subscribe(this._onRender);
this.renderEvent.subscribe(this.onRender);
this.beforeShowEvent.subscribe(this._onBeforeShow);
this.hideEvent.subscribe(this.positionOffScreen);
this.showEvent.subscribe(this._onShow);
this.beforeHideEvent.subscribe(this._onBeforeHide);
this.mouseOverEvent.subscribe(this._onMouseOver);
this.mouseOutEvent.subscribe(this._onMouseOut);
this.clickEvent.subscribe(this._onClick);
this.keyDownEvent.subscribe(this._onKeyDown);
this.keyPressEvent.subscribe(this._onKeyPress);
if(UA.gecko||UA.webkit){
this.cfg.subscribeToConfigEvent("y",this._onYChange);}
if(p_oConfig){
this.cfg.applyConfig(p_oConfig,true);}
MenuManager.addMenu(this);
this.initEvent.fire(Menu);}},
_initSubTree:function(){
var oSrcElement=this.srcElement,
sSrcElementTagName,
nGroup,
sGroupTitleTagName,
oNode,
aListElements,
nListElements,
i;
if(oSrcElement){
sSrcElementTagName=
(oSrcElement.tagName&&oSrcElement.tagName.toUpperCase());
if(sSrcElementTagName=="DIV"){
oNode=this.body.firstChild;
if(oNode){
nGroup=0;
sGroupTitleTagName=this.GROUP_TITLE_TAG_NAME.toUpperCase();
do{
if(oNode&&oNode.tagName){
switch(oNode.tagName.toUpperCase()){
case sGroupTitleTagName:
this._aGroupTitleElements[nGroup]=oNode;
break;
case"UL":
this._aListElements[nGroup]=oNode;
this._aItemGroups[nGroup]=[];
nGroup++;
break;}}}
while((oNode=oNode.nextSibling));
if(this._aListElements[0]){
Dom.addClass(this._aListElements[0],"first-of-type");}}}
oNode=null;
if(sSrcElementTagName){
switch(sSrcElementTagName){
case"DIV":
aListElements=this._aListElements;
nListElements=aListElements.length;
if(nListElements>0){
i=nListElements-1;
do{
oNode=aListElements[i].firstChild;
if(oNode){
do{
if(oNode&&oNode.tagName&&
oNode.tagName.toUpperCase()=="LI"){
this.addItem(new this.ITEM_TYPE(oNode,
{parent:this}),i);}}
while((oNode=oNode.nextSibling));}}
while(i--);}
break;
case"SELECT":
oNode=oSrcElement.firstChild;
do{
if(oNode&&oNode.tagName){
switch(oNode.tagName.toUpperCase()){
case"OPTGROUP":
case"OPTION":
this.addItem(
new this.ITEM_TYPE(
oNode,
{parent:this}));
break;}}}
while((oNode=oNode.nextSibling));
break;}}}},
_getFirstEnabledItem:function(){
var aItems=this.getItems(),
nItems=aItems.length,
oItem;
for(var i=0;i<nItems;i++){
oItem=aItems[i];
if(oItem&&!oItem.cfg.getProperty("disabled")&&
oItem.element.style.display!="none"){
return oItem;}}},
_addItemToGroup:function(p_nGroupIndex,p_oItem,p_nItemIndex){
var oItem,
nGroupIndex,
aGroup,
oGroupItem,
bAppend,
oNextItemSibling,
nItemIndex;
function getNextItemSibling(p_aArray,p_nStartIndex){
return(p_aArray[p_nStartIndex]||getNextItemSibling(p_aArray,
(p_nStartIndex+1)));}
if(p_oItem instanceof this.ITEM_TYPE){
oItem=p_oItem;
oItem.parent=this;}
else if(typeof p_oItem=="string"){
oItem=new this.ITEM_TYPE(p_oItem,{parent:this});}
else if(typeof p_oItem=="object"){
p_oItem.parent=this;
oItem=new this.ITEM_TYPE(p_oItem.text,p_oItem);}
if(oItem){
if(oItem.cfg.getProperty("selected")){
this.activeItem=oItem;}
nGroupIndex=typeof p_nGroupIndex=="number"?p_nGroupIndex:0;
aGroup=this._getItemGroup(nGroupIndex);
if(!aGroup){
aGroup=this._createItemGroup(nGroupIndex);}
if(typeof p_nItemIndex=="number"){
bAppend=(p_nItemIndex>=aGroup.length);
if(aGroup[p_nItemIndex]){
aGroup.splice(p_nItemIndex,0,oItem);}
else{
aGroup[p_nItemIndex]=oItem;}
oGroupItem=aGroup[p_nItemIndex];
if(oGroupItem){
if(bAppend&&(!oGroupItem.element.parentNode||
oGroupItem.element.parentNode.nodeType==11)){
this._aListElements[nGroupIndex].appendChild(
oGroupItem.element);}
else{
oNextItemSibling=getNextItemSibling(aGroup,
(p_nItemIndex+1));
if(oNextItemSibling&&(!oGroupItem.element.parentNode||
oGroupItem.element.parentNode.nodeType==11)){
this._aListElements[nGroupIndex].insertBefore(
oGroupItem.element,
oNextItemSibling.element);}}
oGroupItem.parent=this;
this._subscribeToItemEvents(oGroupItem);
this._configureSubmenu(oGroupItem);
this._updateItemProperties(nGroupIndex);
this.itemAddedEvent.fire(oGroupItem);
this.changeContentEvent.fire();
return oGroupItem;}}
else{
nItemIndex=aGroup.length;
aGroup[nItemIndex]=oItem;
oGroupItem=aGroup[nItemIndex];
if(oGroupItem){
if(!Dom.isAncestor(this._aListElements[nGroupIndex],
oGroupItem.element)){
this._aListElements[nGroupIndex].appendChild(
oGroupItem.element);}
oGroupItem.element.setAttribute("groupindex",nGroupIndex);
oGroupItem.element.setAttribute("index",nItemIndex);
oGroupItem.parent=this;
oGroupItem.index=nItemIndex;
oGroupItem.groupIndex=nGroupIndex;
this._subscribeToItemEvents(oGroupItem);
this._configureSubmenu(oGroupItem);
if(nItemIndex===0){
Dom.addClass(oGroupItem.element,"first-of-type");}
this.itemAddedEvent.fire(oGroupItem);
this.changeContentEvent.fire();
return oGroupItem;}}}},
_removeItemFromGroupByIndex:function(p_nGroupIndex,p_nItemIndex){
var nGroupIndex=typeof p_nGroupIndex=="number"?p_nGroupIndex:0,
aGroup=this._getItemGroup(nGroupIndex),
aArray,
oItem,
oUL;
if(aGroup){
aArray=aGroup.splice(p_nItemIndex,1);
oItem=aArray[0];
if(oItem){
this._updateItemProperties(nGroupIndex);
if(aGroup.length===0){
oUL=this._aListElements[nGroupIndex];
if(this.body&&oUL){
this.body.removeChild(oUL);}
this._aItemGroups.splice(nGroupIndex,1);
this._aListElements.splice(nGroupIndex,1);
oUL=this._aListElements[0];
if(oUL){
Dom.addClass(oUL,"first-of-type");}}
this.itemRemovedEvent.fire(oItem);
this.changeContentEvent.fire();
return oItem;}}},
_removeItemFromGroupByValue:function(p_nGroupIndex,p_oItem){
var aGroup=this._getItemGroup(p_nGroupIndex),
nItems,
nItemIndex,
i;
if(aGroup){
nItems=aGroup.length;
nItemIndex=-1;
if(nItems>0){
i=nItems-1;
do{
if(aGroup[i]==p_oItem){
nItemIndex=i;
break;}}
while(i--);
if(nItemIndex>-1){
return(this._removeItemFromGroupByIndex(p_nGroupIndex,
nItemIndex));}}}},
_updateItemProperties:function(p_nGroupIndex){
var aGroup=this._getItemGroup(p_nGroupIndex),
nItems=aGroup.length,
oItem,
oLI,
i;
if(nItems>0){
i=nItems-1;
do{
oItem=aGroup[i];
if(oItem){
oLI=oItem.element;
oItem.index=i;
oItem.groupIndex=p_nGroupIndex;
oLI.setAttribute("groupindex",p_nGroupIndex);
oLI.setAttribute("index",i);
Dom.removeClass(oLI,"first-of-type");}}
while(i--);
if(oLI){
Dom.addClass(oLI,"first-of-type");}}},
_createItemGroup:function(p_nIndex){
var oUL;
if(!this._aItemGroups[p_nIndex]){
this._aItemGroups[p_nIndex]=[];
oUL=document.createElement("ul");
this._aListElements[p_nIndex]=oUL;
return this._aItemGroups[p_nIndex];}},
_getItemGroup:function(p_nIndex){
var nIndex=((typeof p_nIndex=="number")?p_nIndex:0);
return this._aItemGroups[nIndex];},
_configureSubmenu:function(p_oItem){
var oSubmenu=p_oItem.cfg.getProperty("submenu");
if(oSubmenu){
this.cfg.configChangedEvent.subscribe(this._onParentMenuConfigChange,
oSubmenu,true);
this.renderEvent.subscribe(this._onParentMenuRender,oSubmenu,true);
oSubmenu.beforeShowEvent.subscribe(this._onSubmenuBeforeShow);}},
_subscribeToItemEvents:function(p_oItem){
p_oItem.focusEvent.subscribe(this._onMenuItemFocus);
p_oItem.blurEvent.subscribe(this._onMenuItemBlur);
p_oItem.destroyEvent.subscribe(this._onMenuItemDestroy,p_oItem,this);
p_oItem.cfg.configChangedEvent.subscribe(this._onMenuItemConfigChange,
p_oItem,this);},
_onVisibleChange:function(p_sType,p_aArgs){
var bVisible=p_aArgs[0];
if(bVisible){
Dom.addClass(this.element,"visible");}
else{
Dom.removeClass(this.element,"visible");}},
_cancelHideDelay:function(){
var oRoot=this.getRoot();
if(oRoot._nHideDelayId){
window.clearTimeout(oRoot._nHideDelayId);}},
_execHideDelay:function(){
this._cancelHideDelay();
var oRoot=this.getRoot(),
me=this;
function hideMenu(){
if(oRoot.activeItem){
oRoot.clearActiveItem();}
if(oRoot==me&&!(me instanceof YAHOO.widget.MenuBar)&&
me.cfg.getProperty("position")=="dynamic"){
me.hide();}}
oRoot._nHideDelayId=
window.setTimeout(hideMenu,oRoot.cfg.getProperty("hidedelay"));},
_cancelShowDelay:function(){
var oRoot=this.getRoot();
if(oRoot._nShowDelayId){
window.clearTimeout(oRoot._nShowDelayId);}},
_execShowDelay:function(p_oMenu){
var oRoot=this.getRoot();
function showMenu(){
if(p_oMenu.parent.cfg.getProperty("selected")){
p_oMenu.show();}}
oRoot._nShowDelayId=
window.setTimeout(showMenu,oRoot.cfg.getProperty("showdelay"));},
_execSubmenuHideDelay:function(p_oSubmenu,p_nMouseX,p_nHideDelay){
var me=this;
p_oSubmenu._nSubmenuHideDelayId=window.setTimeout(function(){
if(me._nCurrentMouseX>(p_nMouseX+10)){
p_oSubmenu._nSubmenuHideDelayId=window.setTimeout(function(){
p_oSubmenu.hide();},p_nHideDelay);}
else{
p_oSubmenu.hide();}},50);},
_disableScrollHeader:function(){
if(!this._bHeaderDisabled){
Dom.addClass(this.header,"topscrollbar_disabled");
this._bHeaderDisabled=true;}},
_disableScrollFooter:function(){
if(!this._bFooterDisabled){
Dom.addClass(this.footer,"bottomscrollbar_disabled");
this._bFooterDisabled=true;}},
_enableScrollHeader:function(){
if(this._bHeaderDisabled){
Dom.removeClass(this.header,"topscrollbar_disabled");
this._bHeaderDisabled=false;}},
_enableScrollFooter:function(){
if(this._bFooterDisabled){
Dom.removeClass(this.footer,"bottomscrollbar_disabled");
this._bFooterDisabled=false;}},
_onMouseOver:function(p_sType,p_aArgs){
if(this._bStopMouseEventHandlers){
return false;}
var oEvent=p_aArgs[0],
oItem=p_aArgs[1],
oTarget=Event.getTarget(oEvent),
oParentMenu,
nShowDelay,
bShowDelay,
oActiveItem,
oItemCfg,
oSubmenu;
if(!this._bHandledMouseOverEvent&&(oTarget==this.element||
Dom.isAncestor(this.element,oTarget))){
this._nCurrentMouseX=0;
Event.on(this.element,"mousemove",this._onMouseMove,this,true);
if(!Dom.isAncestor(oItem.element,Event.getRelatedTarget(oEvent))){
this.clearActiveItem();}
if(this.parent&&this._nSubmenuHideDelayId){
window.clearTimeout(this._nSubmenuHideDelayId);
this.parent.cfg.setProperty("selected",true);
oParentMenu=this.parent.parent;
oParentMenu._bHandledMouseOutEvent=true;
oParentMenu._bHandledMouseOverEvent=false;}
this._bHandledMouseOverEvent=true;
this._bHandledMouseOutEvent=false;}
if(oItem&&!oItem.handledMouseOverEvent&&!oItem.cfg.getProperty("disabled")&&
(oTarget==oItem.element||Dom.isAncestor(oItem.element,oTarget))){
nShowDelay=this.cfg.getProperty("showdelay");
bShowDelay=(nShowDelay>0);
if(bShowDelay){
this._cancelShowDelay();}
oActiveItem=this.activeItem;
if(oActiveItem){
oActiveItem.cfg.setProperty("selected",false);}
oItemCfg=oItem.cfg;
oItemCfg.setProperty("selected",true);
if(this.hasFocus()){
oItem.focus();}
if(this.cfg.getProperty("autosubmenudisplay")){
oSubmenu=oItemCfg.getProperty("submenu");
if(oSubmenu){
if(bShowDelay){
this._execShowDelay(oSubmenu);}
else{
oSubmenu.show();}}}
oItem.handledMouseOverEvent=true;
oItem.handledMouseOutEvent=false;}},
_onMouseOut:function(p_sType,p_aArgs){
if(this._bStopMouseEventHandlers){
return false;}
var oEvent=p_aArgs[0],
oItem=p_aArgs[1],
oRelatedTarget=Event.getRelatedTarget(oEvent),
bMovingToSubmenu=false,
oItemCfg,
oSubmenu,
nSubmenuHideDelay,
nShowDelay;
if(oItem&&!oItem.cfg.getProperty("disabled")){
oItemCfg=oItem.cfg;
oSubmenu=oItemCfg.getProperty("submenu");
if(oSubmenu&&(oRelatedTarget==oSubmenu.element||
Dom.isAncestor(oSubmenu.element,oRelatedTarget))){
bMovingToSubmenu=true;}
if(!oItem.handledMouseOutEvent&&((oRelatedTarget!=oItem.element&&!Dom.isAncestor(oItem.element,oRelatedTarget))||
bMovingToSubmenu)){
if(!bMovingToSubmenu){
oItem.cfg.setProperty("selected",false);
if(oSubmenu){
nSubmenuHideDelay=
this.cfg.getProperty("submenuhidedelay");
nShowDelay=this.cfg.getProperty("showdelay");
if(!(this instanceof YAHOO.widget.MenuBar)&&
nSubmenuHideDelay>0&&
nShowDelay>=nSubmenuHideDelay){
this._execSubmenuHideDelay(oSubmenu,
Event.getPageX(oEvent),
nSubmenuHideDelay);}
else{
oSubmenu.hide();}}}
oItem.handledMouseOutEvent=true;
oItem.handledMouseOverEvent=false;}}
if(!this._bHandledMouseOutEvent&&((oRelatedTarget!=this.element&&!Dom.isAncestor(this.element,oRelatedTarget))||bMovingToSubmenu)){
Event.removeListener(this.element,"mousemove",this._onMouseMove);
this._nCurrentMouseX=Event.getPageX(oEvent);
this._bHandledMouseOutEvent=true;
this._bHandledMouseOverEvent=false;}},
_onMouseMove:function(p_oEvent,p_oMenu){
if(this._bStopMouseEventHandlers){
return false;}
this._nCurrentMouseX=Event.getPageX(p_oEvent);},
_onClick:function(p_sType,p_aArgs){
var Event=YAHOO.util.Event,
Dom=YAHOO.util.Dom,
oEvent=p_aArgs[0],
oItem=p_aArgs[1],
oSubmenu,
bInMenuAnchor=false,
oRoot,
sId,
sURL,
nHashPos,
nLen;
if(oItem){
if(oItem.cfg.getProperty("disabled")){
Event.preventDefault(oEvent);}
else{
oSubmenu=oItem.cfg.getProperty("submenu");
sURL=oItem.cfg.getProperty("url");
if(sURL){
nHashPos=sURL.indexOf("#");
nLen=sURL.length;
if(nHashPos!=-1){
sURL=sURL.substr(nHashPos,nLen);
nLen=sURL.length;
if(nLen>1){
sId=sURL.substr(1,nLen);
bInMenuAnchor=Dom.isAncestor(this.element,sId);}
else if(nLen===1){
bInMenuAnchor=true;}}}
if(bInMenuAnchor&&!oItem.cfg.getProperty("target")){
Event.preventDefault(oEvent);
if(UA.webkit){
oItem.focus();}
else{
oItem.focusEvent.fire();}}
if(!oSubmenu){
oRoot=this.getRoot();
if(oRoot instanceof YAHOO.widget.MenuBar||
oRoot.cfg.getProperty("position")=="static"){
oRoot.clearActiveItem();}
else{
oRoot.hide();}}}}},
_onKeyDown:function(p_sType,p_aArgs){
var oEvent=p_aArgs[0],
oItem=p_aArgs[1],
me=this,
oSubmenu,
oItemCfg,
oParentItem,
oRoot,
oNextItem,
oBody,
nBodyScrollTop,
nBodyOffsetHeight,
aItems,
nItems,
nNextItemOffsetTop,
nScrollTarget,
oParentMenu;
function stopMouseEventHandlers(){
me._bStopMouseEventHandlers=true;
window.setTimeout(function(){
me._bStopMouseEventHandlers=false;},10);}
if(oItem&&!oItem.cfg.getProperty("disabled")){
oItemCfg=oItem.cfg;
oParentItem=this.parent;
switch(oEvent.keyCode){
case 38:
case 40:
oNextItem=(oEvent.keyCode==38)?
oItem.getPreviousEnabledSibling():
oItem.getNextEnabledSibling();
if(oNextItem){
this.clearActiveItem();
oNextItem.cfg.setProperty("selected",true);
oNextItem.focus();
if(this.cfg.getProperty("maxheight")>0){
oBody=this.body;
nBodyScrollTop=oBody.scrollTop;
nBodyOffsetHeight=oBody.offsetHeight;
aItems=this.getItems();
nItems=aItems.length-1;
nNextItemOffsetTop=oNextItem.element.offsetTop;
if(oEvent.keyCode==40){
if(nNextItemOffsetTop>=(nBodyOffsetHeight+nBodyScrollTop)){
oBody.scrollTop=nNextItemOffsetTop-nBodyOffsetHeight;}
else if(nNextItemOffsetTop<=nBodyScrollTop){
oBody.scrollTop=0;}
if(oNextItem==aItems[nItems]){
oBody.scrollTop=oNextItem.element.offsetTop;}}
else{
if(nNextItemOffsetTop<=nBodyScrollTop){
oBody.scrollTop=nNextItemOffsetTop-oNextItem.element.offsetHeight;}
else if(nNextItemOffsetTop>=(nBodyScrollTop+nBodyOffsetHeight)){
oBody.scrollTop=nNextItemOffsetTop;}
if(oNextItem==aItems[0]){
oBody.scrollTop=0;}}
nBodyScrollTop=oBody.scrollTop;
nScrollTarget=oBody.scrollHeight-oBody.offsetHeight;
if(nBodyScrollTop===0){
this._disableScrollHeader();
this._enableScrollFooter();}
else if(nBodyScrollTop==nScrollTarget){
this._enableScrollHeader();
this._disableScrollFooter();}
else{
this._enableScrollHeader();
this._enableScrollFooter();}}}
Event.preventDefault(oEvent);
stopMouseEventHandlers();
break;
case 39:
oSubmenu=oItemCfg.getProperty("submenu");
if(oSubmenu){
if(!oItemCfg.getProperty("selected")){
oItemCfg.setProperty("selected",true);}
oSubmenu.show();
oSubmenu.setInitialFocus();
oSubmenu.setInitialSelection();}
else{
oRoot=this.getRoot();
if(oRoot instanceof YAHOO.widget.MenuBar){
oNextItem=oRoot.activeItem.getNextEnabledSibling();
if(oNextItem){
oRoot.clearActiveItem();
oNextItem.cfg.setProperty("selected",true);
oSubmenu=oNextItem.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.show();}
oNextItem.focus();}}}
Event.preventDefault(oEvent);
stopMouseEventHandlers();
break;
case 37:
if(oParentItem){
oParentMenu=oParentItem.parent;
if(oParentMenu instanceof YAHOO.widget.MenuBar){
oNextItem=
oParentMenu.activeItem.getPreviousEnabledSibling();
if(oNextItem){
oParentMenu.clearActiveItem();
oNextItem.cfg.setProperty("selected",true);
oSubmenu=oNextItem.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.show();}
oNextItem.focus();}}
else{
this.hide();
oParentItem.focus();}}
Event.preventDefault(oEvent);
stopMouseEventHandlers();
break;}}
if(oEvent.keyCode==27){
if(this.cfg.getProperty("position")=="dynamic"){
this.hide();
if(this.parent){
this.parent.focus();}}
else if(this.activeItem){
oSubmenu=this.activeItem.cfg.getProperty("submenu");
if(oSubmenu&&oSubmenu.cfg.getProperty("visible")){
oSubmenu.hide();
this.activeItem.focus();}
else{
this.activeItem.blur();
this.activeItem.cfg.setProperty("selected",false);}}
Event.preventDefault(oEvent);}},
_onKeyPress:function(p_sType,p_aArgs){
var oEvent=p_aArgs[0];
if(oEvent.keyCode==40||oEvent.keyCode==38){
Event.preventDefault(oEvent);}},
_onYChange:function(p_sType,p_aArgs){
var oParent=this.parent,
nScrollTop,
oIFrame,
nY;
if(oParent){
nScrollTop=oParent.parent.body.scrollTop;
if(nScrollTop>0){
nY=(this.cfg.getProperty("y")-nScrollTop);
Dom.setY(this.element,nY);
oIFrame=this.iframe;
if(oIFrame){
Dom.setY(oIFrame,nY);}
this.cfg.setProperty("y",nY,true);}}},
_onScrollTargetMouseOver:function(p_oEvent,p_oMenu){
this._cancelHideDelay();
var oTarget=Event.getTarget(p_oEvent),
oBody=this.body,
me=this,
nScrollIncrement=this.cfg.getProperty("scrollincrement"),
nScrollTarget,
fnScrollFunction;
function scrollBodyDown(){
var nScrollTop=oBody.scrollTop;
if(nScrollTop<nScrollTarget){
oBody.scrollTop=(nScrollTop+nScrollIncrement);
me._enableScrollHeader();}
else{
oBody.scrollTop=nScrollTarget;
window.clearInterval(me._nBodyScrollId);
me._disableScrollFooter();}}
function scrollBodyUp(){
var nScrollTop=oBody.scrollTop;
if(nScrollTop>0){
oBody.scrollTop=(nScrollTop-nScrollIncrement);
me._enableScrollFooter();}
else{
oBody.scrollTop=0;
window.clearInterval(me._nBodyScrollId);
me._disableScrollHeader();}}
if(Dom.hasClass(oTarget,"hd")){
fnScrollFunction=scrollBodyUp;}
else{
nScrollTarget=oBody.scrollHeight-oBody.offsetHeight;
fnScrollFunction=scrollBodyDown;}
this._nBodyScrollId=window.setInterval(fnScrollFunction,10);},
_onScrollTargetMouseOut:function(p_oEvent,p_oMenu){
window.clearInterval(this._nBodyScrollId);
this._cancelHideDelay();},
_onInit:function(p_sType,p_aArgs){
this.cfg.subscribeToConfigEvent("visible",this._onVisibleChange);
var bRootMenu=!this.parent,
bLazyLoad=this.lazyLoad;
if(((bRootMenu&&!bLazyLoad)||
(bRootMenu&&(this.cfg.getProperty("visible")||
this.cfg.getProperty("position")=="static"))||
(!bRootMenu&&!bLazyLoad))&&this.getItemGroups().length===0){
if(this.srcElement){
this._initSubTree();}
if(this.itemData){
this.addItems(this.itemData);}}
else if(bLazyLoad){
this.cfg.fireQueue();}},
_onBeforeRender:function(p_sType,p_aArgs){
var oEl=this.element,
nListElements=this._aListElements.length,
bFirstList=true,
i=0,
oUL,
oGroupTitle;
if(nListElements>0){
do{
oUL=this._aListElements[i];
if(oUL){
if(bFirstList){
Dom.addClass(oUL,"first-of-type");
bFirstList=false;}
if(!Dom.isAncestor(oEl,oUL)){
this.appendToBody(oUL);}
oGroupTitle=this._aGroupTitleElements[i];
if(oGroupTitle){
if(!Dom.isAncestor(oEl,oGroupTitle)){
oUL.parentNode.insertBefore(oGroupTitle,oUL);}
Dom.addClass(oUL,"hastitle");}}
i++;}
while(i<nListElements);}},
_onRender:function(p_sType,p_aArgs){
if(this.cfg.getProperty("position")=="dynamic"){
if(!this.cfg.getProperty("visible")){
this.positionOffScreen();}}},
_onBeforeShow:function(p_sType,p_aArgs){
var nOptions,
n,
nViewportHeight,
oRegion,
oSrcElement;
if(this.lazyLoad&&this.getItemGroups().length===0){
if(this.srcElement){
this._initSubTree();}
if(this.itemData){
if(this.parent&&this.parent.parent&&
this.parent.parent.srcElement&&
this.parent.parent.srcElement.tagName.toUpperCase()=="SELECT"){
nOptions=this.itemData.length;
for(n=0;n<nOptions;n++){
if(this.itemData[n].tagName){
this.addItem((new this.ITEM_TYPE(this.itemData[n])));}}}
else{
this.addItems(this.itemData);}}
oSrcElement=this.srcElement;
if(oSrcElement){
if(oSrcElement.tagName.toUpperCase()=="SELECT"){
if(Dom.inDocument(oSrcElement)){
this.render(oSrcElement.parentNode);}
else{
this.render(this.cfg.getProperty("container"));}}
else{
this.render();}}
else{
if(this.parent){
this.render(this.parent.element);}
else{
this.render(this.cfg.getProperty("container"));}}}
var nMaxHeight=this.cfg.getProperty("maxheight"),
nMinScrollHeight=this.cfg.getProperty("minscrollheight"),
bDynamicPos=this.cfg.getProperty("position")=="dynamic";
if(!this.parent&&bDynamicPos){
this.cfg.refireEvent("xy");}
function clearMaxHeight(){
this.cfg.setProperty("maxheight",0);
this.hideEvent.unsubscribe(clearMaxHeight);}
if(!(this instanceof YAHOO.widget.MenuBar)&&bDynamicPos){
if(nMaxHeight===0){
nViewportHeight=Dom.getViewportHeight();
if(this.parent&&
this.parent.parent instanceof YAHOO.widget.MenuBar){
oRegion=YAHOO.util.Region.getRegion(this.parent.element);
nViewportHeight=(nViewportHeight-oRegion.bottom);}
if(this.element.offsetHeight>=nViewportHeight){
nMaxHeight=(nViewportHeight-(Overlay.VIEWPORT_OFFSET*2));
if(nMaxHeight<nMinScrollHeight){
nMaxHeight=nMinScrollHeight;}
this.cfg.setProperty("maxheight",nMaxHeight);
this.hideEvent.subscribe(clearMaxHeight);}}}},
_onShow:function(p_sType,p_aArgs){
var oParent=this.parent,
oParentMenu,
aParentAlignment,
aAlignment;
function disableAutoSubmenuDisplay(p_oEvent){
var oTarget;
if(p_oEvent.type=="mousedown"||(p_oEvent.type=="keydown"&&
p_oEvent.keyCode==27)){
oTarget=Event.getTarget(p_oEvent);
if(oTarget!=oParentMenu.element||!Dom.isAncestor(oParentMenu.element,oTarget)){
oParentMenu.cfg.setProperty("autosubmenudisplay",false);
Event.removeListener(document,"mousedown",
disableAutoSubmenuDisplay);
Event.removeListener(document,"keydown",
disableAutoSubmenuDisplay);}}}
if(oParent){
oParentMenu=oParent.parent;
aParentAlignment=oParentMenu.cfg.getProperty("submenualignment");
aAlignment=this.cfg.getProperty("submenualignment");
if((aParentAlignment[0]!=aAlignment[0])&&
(aParentAlignment[1]!=aAlignment[1])){
this.cfg.setProperty("submenualignment",
[aParentAlignment[0],aParentAlignment[1]]);}
if(!oParentMenu.cfg.getProperty("autosubmenudisplay")&&
(oParentMenu instanceof YAHOO.widget.MenuBar||
oParentMenu.cfg.getProperty("position")=="static")){
oParentMenu.cfg.setProperty("autosubmenudisplay",true);
Event.on(document,"mousedown",disableAutoSubmenuDisplay);
Event.on(document,"keydown",disableAutoSubmenuDisplay);}}},
_onBeforeHide:function(p_sType,p_aArgs){
var oActiveItem=this.activeItem,
oConfig,
oSubmenu;
if(oActiveItem){
oConfig=oActiveItem.cfg;
oConfig.setProperty("selected",false);
oSubmenu=oConfig.getProperty("submenu");
if(oSubmenu){
oSubmenu.hide();}}
if(this.getRoot()==this){
this.blur();}},
_onParentMenuConfigChange:function(p_sType,p_aArgs,p_oSubmenu){
var sPropertyName=p_aArgs[0][0],
oPropertyValue=p_aArgs[0][1];
switch(sPropertyName){
case"iframe":
case"constraintoviewport":
case"hidedelay":
case"showdelay":
case"submenuhidedelay":
case"clicktohide":
case"effect":
case"classname":
case"scrollincrement":
case"minscrollheight":
p_oSubmenu.cfg.setProperty(sPropertyName,oPropertyValue);
break;}},
_onParentMenuRender:function(p_sType,p_aArgs,p_oSubmenu){
var oParentCfg=p_oSubmenu.parent.parent.cfg,
oConfig={
constraintoviewport:oParentCfg.getProperty("constraintoviewport"),
xy:[0,0],
clicktohide:oParentCfg.getProperty("clicktohide"),
effect:oParentCfg.getProperty("effect"),
showdelay:oParentCfg.getProperty("showdelay"),
hidedelay:oParentCfg.getProperty("hidedelay"),
submenuhidedelay:oParentCfg.getProperty("submenuhidedelay"),
classname:oParentCfg.getProperty("classname"),
scrollincrement:oParentCfg.getProperty("scrollincrement"),
minscrollheight:oParentCfg.getProperty("minscrollheight"),
iframe:oParentCfg.getProperty("iframe")},
oLI;
p_oSubmenu.cfg.applyConfig(oConfig);
if(!this.lazyLoad){
oLI=this.parent.element;
if(this.element.parentNode==oLI){
this.render();}
else{
this.render(oLI);}}},
_onSubmenuBeforeShow:function(p_sType,p_aArgs){
var oParent=this.parent,
aAlignment=oParent.parent.cfg.getProperty("submenualignment");
if(!this.cfg.getProperty("context")){
this.cfg.setProperty("context",
[oParent.element,aAlignment[0],aAlignment[1]]);}
else{
this.align();}},
_onMenuItemFocus:function(p_sType,p_aArgs){
this.parent.focusEvent.fire(this);},
_onMenuItemBlur:function(p_sType,p_aArgs){
this.parent.blurEvent.fire(this);},
_onMenuItemDestroy:function(p_sType,p_aArgs,p_oItem){
this._removeItemFromGroupByValue(p_oItem.groupIndex,p_oItem);},
_onMenuItemConfigChange:function(p_sType,p_aArgs,p_oItem){
var sPropertyName=p_aArgs[0][0],
oPropertyValue=p_aArgs[0][1],
oSubmenu;
switch(sPropertyName){
case"selected":
if(oPropertyValue===true){
this.activeItem=p_oItem;}
break;
case"submenu":
oSubmenu=p_aArgs[0][1];
if(oSubmenu){
this._configureSubmenu(p_oItem);}
break;}},
enforceConstraints:function(type,args,obj){
YAHOO.widget.Menu.superclass.enforceConstraints.apply(this,arguments);
var oParent=this.parent,
oParentMenu,
nParentMenuX,
nNewX,
nX;
if(oParent){
oParentMenu=oParent.parent;
if(!(oParentMenu instanceof YAHOO.widget.MenuBar)){
nParentMenuX=oParentMenu.cfg.getProperty("x");
nX=this.cfg.getProperty("x");
if(nX<(nParentMenuX+oParent.element.offsetWidth)){
nNewX=(nParentMenuX-this.element.offsetWidth);
this.cfg.setProperty("x",nNewX,true);
this.cfg.setProperty("xy",[nNewX,(this.cfg.getProperty("y"))],true);}}}},
configVisible:function(p_sType,p_aArgs,p_oMenu){
var bVisible,
sDisplay;
if(this.cfg.getProperty("position")=="dynamic"){
Menu.superclass.configVisible.call(this,p_sType,p_aArgs,p_oMenu);}
else{
bVisible=p_aArgs[0];
sDisplay=Dom.getStyle(this.element,"display");
Dom.setStyle(this.element,"visibility","visible");
if(bVisible){
if(sDisplay!="block"){
this.beforeShowEvent.fire();
Dom.setStyle(this.element,"display","block");
this.showEvent.fire();}}
else{
if(sDisplay=="block"){
this.beforeHideEvent.fire();
Dom.setStyle(this.element,"display","none");
this.hideEvent.fire();}}}},
configPosition:function(p_sType,p_aArgs,p_oMenu){
var oElement=this.element,
sCSSPosition=p_aArgs[0]=="static"?"static":"absolute",
oCfg=this.cfg,
nZIndex;
Dom.setStyle(oElement,"position",sCSSPosition);
if(sCSSPosition=="static"){
Dom.setStyle(oElement,"display","block");
oCfg.setProperty("visible",true);}
else{
Dom.setStyle(oElement,"visibility","hidden");}
if(sCSSPosition=="absolute"){
nZIndex=oCfg.getProperty("zindex");
if(!nZIndex||nZIndex===0){
nZIndex=this.parent?
(this.parent.parent.cfg.getProperty("zindex")+1):1;
oCfg.setProperty("zindex",nZIndex);}}},
configIframe:function(p_sType,p_aArgs,p_oMenu){
if(this.cfg.getProperty("position")=="dynamic"){
Menu.superclass.configIframe.call(this,p_sType,p_aArgs,p_oMenu);}},
configHideDelay:function(p_sType,p_aArgs,p_oMenu){
var nHideDelay=p_aArgs[0],
oMouseOutEvent=this.mouseOutEvent,
oMouseOverEvent=this.mouseOverEvent,
oKeyDownEvent=this.keyDownEvent;
if(nHideDelay>0){
if(!this._bHideDelayEventHandlersAssigned){
oMouseOutEvent.subscribe(this._execHideDelay);
oMouseOverEvent.subscribe(this._cancelHideDelay);
oKeyDownEvent.subscribe(this._cancelHideDelay);
this._bHideDelayEventHandlersAssigned=true;}}
else{
oMouseOutEvent.unsubscribe(this._execHideDelay);
oMouseOverEvent.unsubscribe(this._cancelHideDelay);
oKeyDownEvent.unsubscribe(this._cancelHideDelay);
this._bHideDelayEventHandlersAssigned=false;}},
configContainer:function(p_sType,p_aArgs,p_oMenu){
var oElement=p_aArgs[0];
if(typeof oElement=='string'){
this.cfg.setProperty("container",document.getElementById(oElement),
true);}},
_setMaxHeight:function(p_sType,p_aArgs,p_nMaxHeight){
this.cfg.setProperty("maxheight",p_nMaxHeight);
this.renderEvent.unsubscribe(this._setMaxHeight);},
configMaxHeight:function(p_sType,p_aArgs,p_oMenu){
var nMaxHeight=p_aArgs[0],
oElement=this.element,
oBody=this.body,
oHeader=this.header,
oFooter=this.footer,
fnMouseOver=this._onScrollTargetMouseOver,
fnMouseOut=this._onScrollTargetMouseOut,
nMinScrollHeight=this.cfg.getProperty("minscrollheight"),
nHeight,
nOffsetWidth,
sWidth;
if(nMaxHeight!==0&&nMaxHeight<nMinScrollHeight){
nMaxHeight=nMinScrollHeight;}
if(this.lazyLoad&&!oBody){
this.renderEvent.unsubscribe(this._setMaxHeight);
if(nMaxHeight>0){
this.renderEvent.subscribe(this._setMaxHeight,nMaxHeight,this);}
return;}
Dom.setStyle(oBody,"height","");
Dom.removeClass(oBody,"yui-menu-body-scrolled");
var bSetWidth=((UA.gecko&&this.parent&&this.parent.parent&&
this.parent.parent.cfg.getProperty("position")=="dynamic")||UA.ie);
if(bSetWidth){
if(!this.cfg.getProperty("width")){
nOffsetWidth=oElement.offsetWidth;
oElement.style.width=nOffsetWidth+"px";
sWidth=(nOffsetWidth-(oElement.offsetWidth-nOffsetWidth))+"px";
this.cfg.setProperty("width",sWidth);}}
if(!oHeader&&!oFooter){
this.setHeader("&#32;");
this.setFooter("&#32;");
oHeader=this.header;
oFooter=this.footer;
Dom.addClass(oHeader,"topscrollbar");
Dom.addClass(oFooter,"bottomscrollbar");
oElement.insertBefore(oHeader,oBody);
oElement.appendChild(oFooter);}
nHeight=(nMaxHeight-(oHeader.offsetHeight+oHeader.offsetHeight));
if(nHeight>0&&(oBody.offsetHeight>nMaxHeight)){
Dom.addClass(oBody,"yui-menu-body-scrolled");
Dom.setStyle(oBody,"height",(nHeight+"px"));
Event.on(oHeader,"mouseover",fnMouseOver,this,true);
Event.on(oHeader,"mouseout",fnMouseOut,this,true);
Event.on(oFooter,"mouseover",fnMouseOver,this,true);
Event.on(oFooter,"mouseout",fnMouseOut,this,true);
this._disableScrollHeader();
this._enableScrollFooter();}
else if(oHeader&&oFooter){
if(bSetWidth){
this.cfg.setProperty("width","");}
this._enableScrollHeader();
this._enableScrollFooter();
Event.removeListener(oHeader,"mouseover",fnMouseOver);
Event.removeListener(oHeader,"mouseout",fnMouseOut);
Event.removeListener(oFooter,"mouseover",fnMouseOver);
Event.removeListener(oFooter,"mouseout",fnMouseOut);
oElement.removeChild(oHeader);
oElement.removeChild(oFooter);
this.header=null;
this.footer=null;}
this.cfg.refireEvent("iframe");},
configClassName:function(p_sType,p_aArgs,p_oMenu){
var sClassName=p_aArgs[0];
if(this._sClassName){
Dom.removeClass(this.element,this._sClassName);}
Dom.addClass(this.element,sClassName);
this._sClassName=sClassName;},
_onItemAdded:function(p_sType,p_aArgs){
var oItem=p_aArgs[0];
if(oItem){
oItem.cfg.setProperty("disabled",true);}},
configDisabled:function(p_sType,p_aArgs,p_oMenu){
var bDisabled=p_aArgs[0],
aItems=this.getItems(),
nItems,
i;
if(Lang.isArray(aItems)){
nItems=aItems.length;
if(nItems>0){
i=nItems-1;
do{
aItems[i].cfg.setProperty("disabled",bDisabled);}
while(i--);}
if(bDisabled){
this.clearActiveItem(true);
Dom.addClass(this.element,"disabled");
this.itemAddedEvent.subscribe(this._onItemAdded);}
else{
Dom.removeClass(this.element,"disabled");
this.itemAddedEvent.unsubscribe(this._onItemAdded);}}},
onRender:function(p_sType,p_aArgs){
function sizeShadow(){
var oElement=this.element,
oShadow=this._shadow;
if(oShadow&&oElement){
oShadow.style.width=(oElement.offsetWidth+6)+"px";
oShadow.style.height=(oElement.offsetHeight+1)+"px";}}
function replaceShadow(){
this.element.appendChild(this._shadow);}
function addShadowVisibleClass(){
Dom.addClass(this._shadow,"yui-menu-shadow-visible");}
function removeShadowVisibleClass(){
Dom.removeClass(this._shadow,"yui-menu-shadow-visible");}
function createShadow(){
var oShadow=this._shadow,
oElement,
me;
if(!oShadow){
oElement=this.element;
me=this;
if(!m_oShadowTemplate){
m_oShadowTemplate=document.createElement("div");
m_oShadowTemplate.className="yui-menu-shadow yui-menu-shadow-visible";}
oShadow=m_oShadowTemplate.cloneNode(false);
oElement.appendChild(oShadow);
this._shadow=oShadow;
this.beforeShowEvent.subscribe(addShadowVisibleClass);
this.beforeHideEvent.subscribe(removeShadowVisibleClass);
if(UA.ie){
window.setTimeout(function(){
sizeShadow.call(me);
me.syncIframe();},0);
this.cfg.subscribeToConfigEvent("width",sizeShadow);
this.cfg.subscribeToConfigEvent("height",sizeShadow);
this.cfg.subscribeToConfigEvent("maxheight",sizeShadow);
this.changeContentEvent.subscribe(sizeShadow);
Module.textResizeEvent.subscribe(sizeShadow,me,true);
this.destroyEvent.subscribe(function(){
Module.textResizeEvent.unsubscribe(sizeShadow,me);});}
this.cfg.subscribeToConfigEvent("maxheight",replaceShadow);}}
function onBeforeShow(){
createShadow.call(this);
this.beforeShowEvent.unsubscribe(onBeforeShow);}
if(this.cfg.getProperty("position")=="dynamic"){
if(this.cfg.getProperty("visible")){
createShadow.call(this);}
else{
this.beforeShowEvent.subscribe(onBeforeShow);}}},
initEvents:function(){
Menu.superclass.initEvents.call(this);
var SIGNATURE=CustomEvent.LIST;
this.mouseOverEvent=this.createEvent(EVENT_TYPES.MOUSE_OVER);
this.mouseOverEvent.signature=SIGNATURE;
this.mouseOutEvent=this.createEvent(EVENT_TYPES.MOUSE_OUT);
this.mouseOutEvent.signature=SIGNATURE;
this.mouseDownEvent=this.createEvent(EVENT_TYPES.MOUSE_DOWN);
this.mouseDownEvent.signature=SIGNATURE;
this.mouseUpEvent=this.createEvent(EVENT_TYPES.MOUSE_UP);
this.mouseUpEvent.signature=SIGNATURE;
this.clickEvent=this.createEvent(EVENT_TYPES.CLICK);
this.clickEvent.signature=SIGNATURE;
this.keyPressEvent=this.createEvent(EVENT_TYPES.KEY_PRESS);
this.keyPressEvent.signature=SIGNATURE;
this.keyDownEvent=this.createEvent(EVENT_TYPES.KEY_DOWN);
this.keyDownEvent.signature=SIGNATURE;
this.keyUpEvent=this.createEvent(EVENT_TYPES.KEY_UP);
this.keyUpEvent.signature=SIGNATURE;
this.focusEvent=this.createEvent(EVENT_TYPES.FOCUS);
this.focusEvent.signature=SIGNATURE;
this.blurEvent=this.createEvent(EVENT_TYPES.BLUR);
this.blurEvent.signature=SIGNATURE;
this.itemAddedEvent=this.createEvent(EVENT_TYPES.ITEM_ADDED);
this.itemAddedEvent.signature=SIGNATURE;
this.itemRemovedEvent=this.createEvent(EVENT_TYPES.ITEM_REMOVED);
this.itemRemovedEvent.signature=SIGNATURE;},
positionOffScreen:function(){
var oIFrame=this.iframe,
aPos=this.OFF_SCREEN_POSITION;
Dom.setXY(this.element,aPos);
if(oIFrame){
Dom.setXY(oIFrame,aPos);}},
getRoot:function(){
var oItem=this.parent,
oParentMenu;
if(oItem){
oParentMenu=oItem.parent;
return oParentMenu?oParentMenu.getRoot():this;}
else{
return this;}},
toString:function(){
var sReturnVal="Menu",
sId=this.id;
if(sId){
sReturnVal+=(" "+sId);}
return sReturnVal;},
setItemGroupTitle:function(p_sGroupTitle,p_nGroupIndex){
var nGroupIndex,
oTitle,
i,
nFirstIndex;
if(typeof p_sGroupTitle=="string"&&p_sGroupTitle.length>0){
nGroupIndex=typeof p_nGroupIndex=="number"?p_nGroupIndex:0;
oTitle=this._aGroupTitleElements[nGroupIndex];
if(oTitle){
oTitle.innerHTML=p_sGroupTitle;}
else{
oTitle=document.createElement(this.GROUP_TITLE_TAG_NAME);
oTitle.innerHTML=p_sGroupTitle;
this._aGroupTitleElements[nGroupIndex]=oTitle;}
i=this._aGroupTitleElements.length-1;
do{
if(this._aGroupTitleElements[i]){
Dom.removeClass(this._aGroupTitleElements[i],"first-of-type");
nFirstIndex=i;}}
while(i--);
if(nFirstIndex!==null){
Dom.addClass(this._aGroupTitleElements[nFirstIndex],"first-of-type");}
this.changeContentEvent.fire();}},
addItem:function(p_oItem,p_nGroupIndex){
if(p_oItem){
return this._addItemToGroup(p_nGroupIndex,p_oItem);}},
addItems:function(p_aItems,p_nGroupIndex){
var nItems,
aItems,
oItem,
i;
if(Lang.isArray(p_aItems)){
nItems=p_aItems.length;
aItems=[];
for(i=0;i<nItems;i++){
oItem=p_aItems[i];
if(oItem){
if(Lang.isArray(oItem)){
aItems[aItems.length]=this.addItems(oItem,i);}
else{
aItems[aItems.length]=
this._addItemToGroup(p_nGroupIndex,oItem);}}}
if(aItems.length){
return aItems;}}},
insertItem:function(p_oItem,p_nItemIndex,p_nGroupIndex){
if(p_oItem){
return this._addItemToGroup(p_nGroupIndex,p_oItem,p_nItemIndex);}},
removeItem:function(p_oObject,p_nGroupIndex){
var oItem;
if(typeof p_oObject!="undefined"){
if(p_oObject instanceof YAHOO.widget.MenuItem){
oItem=this._removeItemFromGroupByValue(p_nGroupIndex,p_oObject);}
else if(typeof p_oObject=="number"){
oItem=this._removeItemFromGroupByIndex(p_nGroupIndex,p_oObject);}
if(oItem){
oItem.destroy();
return oItem;}}},
getItems:function(){
var aGroups=this._aItemGroups,
nGroups,
aItems=[];
if(Lang.isArray(aGroups)){
nGroups=aGroups.length;
return((nGroups==1)?aGroups[0]:
(Array.prototype.concat.apply(aItems,aGroups)));}},
getItemGroups:function(){
return this._aItemGroups;},
getItem:function(p_nItemIndex,p_nGroupIndex){
var aGroup;
if(typeof p_nItemIndex=="number"){
aGroup=this._getItemGroup(p_nGroupIndex);
if(aGroup){
return aGroup[p_nItemIndex];}}},
getSubmenus:function(){
var aItems=this.getItems(),
nItems=aItems.length,
aSubmenus,
oSubmenu,
oItem,
i;
if(nItems>0){
aSubmenus=[];
for(i=0;i<nItems;i++){
oItem=aItems[i];
if(oItem){
oSubmenu=oItem.cfg.getProperty("submenu");
if(oSubmenu){
aSubmenus[aSubmenus.length]=oSubmenu;}}}}
return aSubmenus;},
clearContent:function(){
var aItems=this.getItems(),
nItems=aItems.length,
oElement=this.element,
oBody=this.body,
oHeader=this.header,
oFooter=this.footer,
oItem,
oSubmenu,
i;
if(nItems>0){
i=nItems-1;
do{
oItem=aItems[i];
if(oItem){
oSubmenu=oItem.cfg.getProperty("submenu");
if(oSubmenu){
this.cfg.configChangedEvent.unsubscribe(
this._onParentMenuConfigChange,oSubmenu);
this.renderEvent.unsubscribe(this._onParentMenuRender,
oSubmenu);}
this.removeItem(oItem);}}
while(i--);}
if(oHeader){
Event.purgeElement(oHeader);
oElement.removeChild(oHeader);}
if(oFooter){
Event.purgeElement(oFooter);
oElement.removeChild(oFooter);}
if(oBody){
Event.purgeElement(oBody);
oBody.innerHTML="";}
this.activeItem=null;
this._aItemGroups=[];
this._aListElements=[];
this._aGroupTitleElements=[];
this.cfg.setProperty("width",null);},
destroy:function(){
this.clearContent();
this._aItemGroups=null;
this._aListElements=null;
this._aGroupTitleElements=null;
Menu.superclass.destroy.call(this);},
setInitialFocus:function(){
var oItem=this._getFirstEnabledItem();
if(oItem){
oItem.focus();}},
setInitialSelection:function(){
var oItem=this._getFirstEnabledItem();
if(oItem){
oItem.cfg.setProperty("selected",true);}},
clearActiveItem:function(p_bBlur){
if(this.cfg.getProperty("showdelay")>0){
this._cancelShowDelay();}
var oActiveItem=this.activeItem,
oConfig,
oSubmenu;
if(oActiveItem){
oConfig=oActiveItem.cfg;
if(p_bBlur){
oActiveItem.blur();}
oConfig.setProperty("selected",false);
oSubmenu=oConfig.getProperty("submenu");
if(oSubmenu){
oSubmenu.hide();}
this.activeItem=null;}},
focus:function(){
if(!this.hasFocus()){
this.setInitialFocus();}},
blur:function(){
var oItem;
if(this.hasFocus()){
oItem=MenuManager.getFocusedMenuItem();
if(oItem){
oItem.blur();}}},
hasFocus:function(){
return(MenuManager.getFocusedMenu()==this.getRoot());},
subscribe:function(){
function onItemAdded(p_sType,p_aArgs,p_oObject){
var oItem=p_aArgs[0],
oSubmenu=oItem.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.subscribe.apply(oSubmenu,p_oObject);}}
function onSubmenuAdded(p_sType,p_aArgs,p_oObject){
var oSubmenu=this.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.subscribe.apply(oSubmenu,p_oObject);}}
Menu.superclass.subscribe.apply(this,arguments);
Menu.superclass.subscribe.call(this,"itemAdded",onItemAdded,arguments);
var aItems=this.getItems(),
nItems,
oItem,
oSubmenu,
i;
if(aItems){
nItems=aItems.length;
if(nItems>0){
i=nItems-1;
do{
oItem=aItems[i];
oSubmenu=oItem.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.subscribe.apply(oSubmenu,arguments);}
else{
oItem.cfg.subscribeToConfigEvent("submenu",onSubmenuAdded,arguments);}}
while(i--);}}},
initDefaultConfig:function(){
Menu.superclass.initDefaultConfig.call(this);
var oConfig=this.cfg;
oConfig.addProperty(
DEFAULT_CONFIG.VISIBLE.key,
{
handler:this.configVisible,
value:DEFAULT_CONFIG.VISIBLE.value,
validator:DEFAULT_CONFIG.VISIBLE.validator});
oConfig.addProperty(
DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.key,
{
handler:this.configConstrainToViewport,
value:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.value,
validator:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.validator,
supercedes:DEFAULT_CONFIG.CONSTRAIN_TO_VIEWPORT.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.POSITION.key,
{
handler:this.configPosition,
value:DEFAULT_CONFIG.POSITION.value,
validator:DEFAULT_CONFIG.POSITION.validator,
supercedes:DEFAULT_CONFIG.POSITION.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.SUBMENU_ALIGNMENT.key,
{
value:DEFAULT_CONFIG.SUBMENU_ALIGNMENT.value,
suppressEvent:DEFAULT_CONFIG.SUBMENU_ALIGNMENT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.key,
{
value:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.value,
validator:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.validator,
suppressEvent:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.SHOW_DELAY.key,
{
value:DEFAULT_CONFIG.SHOW_DELAY.value,
validator:DEFAULT_CONFIG.SHOW_DELAY.validator,
suppressEvent:DEFAULT_CONFIG.SHOW_DELAY.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.HIDE_DELAY.key,
{
handler:this.configHideDelay,
value:DEFAULT_CONFIG.HIDE_DELAY.value,
validator:DEFAULT_CONFIG.HIDE_DELAY.validator,
suppressEvent:DEFAULT_CONFIG.HIDE_DELAY.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.key,
{
value:DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.value,
validator:DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.validator,
suppressEvent:DEFAULT_CONFIG.SUBMENU_HIDE_DELAY.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.CLICK_TO_HIDE.key,
{
value:DEFAULT_CONFIG.CLICK_TO_HIDE.value,
validator:DEFAULT_CONFIG.CLICK_TO_HIDE.validator,
suppressEvent:DEFAULT_CONFIG.CLICK_TO_HIDE.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.CONTAINER.key,
{
handler:this.configContainer,
value:document.body,
suppressEvent:DEFAULT_CONFIG.CONTAINER.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.SCROLL_INCREMENT.key,
{
value:DEFAULT_CONFIG.SCROLL_INCREMENT.value,
validator:DEFAULT_CONFIG.SCROLL_INCREMENT.validator,
supercedes:DEFAULT_CONFIG.SCROLL_INCREMENT.supercedes,
suppressEvent:DEFAULT_CONFIG.SCROLL_INCREMENT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.MIN_SCROLL_HEIGHT.key,
{
value:DEFAULT_CONFIG.MIN_SCROLL_HEIGHT.value,
validator:DEFAULT_CONFIG.MIN_SCROLL_HEIGHT.validator,
supercedes:DEFAULT_CONFIG.MIN_SCROLL_HEIGHT.supercedes,
suppressEvent:DEFAULT_CONFIG.MIN_SCROLL_HEIGHT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.MAX_HEIGHT.key,
{
handler:this.configMaxHeight,
value:DEFAULT_CONFIG.MAX_HEIGHT.value,
validator:DEFAULT_CONFIG.MAX_HEIGHT.validator,
suppressEvent:DEFAULT_CONFIG.MAX_HEIGHT.suppressEvent,
supercedes:DEFAULT_CONFIG.MAX_HEIGHT.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.CLASS_NAME.key,
{
handler:this.configClassName,
value:DEFAULT_CONFIG.CLASS_NAME.value,
validator:DEFAULT_CONFIG.CLASS_NAME.validator,
supercedes:DEFAULT_CONFIG.CLASS_NAME.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.DISABLED.key,
{
handler:this.configDisabled,
value:DEFAULT_CONFIG.DISABLED.value,
validator:DEFAULT_CONFIG.DISABLED.validator,
suppressEvent:DEFAULT_CONFIG.DISABLED.suppressEvent});}});})();
(function(){
YAHOO.widget.MenuItem=function(p_oObject,p_oConfig){
if(p_oObject){
if(p_oConfig){
this.parent=p_oConfig.parent;
this.value=p_oConfig.value;
this.id=p_oConfig.id;}
this.init(p_oObject,p_oConfig);}};
var Dom=YAHOO.util.Dom,
Module=YAHOO.widget.Module,
Menu=YAHOO.widget.Menu,
MenuItem=YAHOO.widget.MenuItem,
CustomEvent=YAHOO.util.CustomEvent,
Lang=YAHOO.lang,
m_oMenuItemTemplate,
EVENT_TYPES={"MOUSE_OVER":"mouseover","MOUSE_OUT":"mouseout","MOUSE_DOWN":"mousedown","MOUSE_UP":"mouseup","CLICK":"click","KEY_PRESS":"keypress","KEY_DOWN":"keydown","KEY_UP":"keyup","ITEM_ADDED":"itemAdded","ITEM_REMOVED":"itemRemoved","FOCUS":"focus","BLUR":"blur","DESTROY":"destroy"},
DEFAULT_CONFIG={"TEXT":{
key:"text",
value:"",
validator:Lang.isString,
suppressEvent:true},"HELP_TEXT":{
key:"helptext",
supercedes:["text"],
suppressEvent:true},"URL":{
key:"url",
value:"#",
suppressEvent:true},"TARGET":{
key:"target",
suppressEvent:true},"EMPHASIS":{
key:"emphasis",
value:false,
validator:Lang.isBoolean,
suppressEvent:true,
supercedes:["text"]},"STRONG_EMPHASIS":{
key:"strongemphasis",
value:false,
validator:Lang.isBoolean,
suppressEvent:true,
supercedes:["text"]},"CHECKED":{
key:"checked",
value:false,
validator:Lang.isBoolean,
suppressEvent:true,
supercedes:["disabled","selected"]},"SUBMENU":{
key:"submenu",
suppressEvent:true,
supercedes:["disabled","selected"]},"DISABLED":{
key:"disabled",
value:false,
validator:Lang.isBoolean,
suppressEvent:true,
supercedes:["text","selected"]},"SELECTED":{
key:"selected",
value:false,
validator:Lang.isBoolean,
suppressEvent:true},"ONCLICK":{
key:"onclick",
suppressEvent:true},"CLASS_NAME":{
key:"classname",
value:null,
validator:Lang.isString,
suppressEvent:true}};
MenuItem.prototype={
CSS_CLASS_NAME:"yuimenuitem",
CSS_LABEL_CLASS_NAME:"yuimenuitemlabel",
SUBMENU_TYPE:null,
_oAnchor:null,
_oHelpTextEM:null,
_oSubmenu:null,
_oOnclickAttributeValue:null,
_sClassName:null,
constructor:MenuItem,
index:null,
groupIndex:null,
parent:null,
element:null,
srcElement:null,
value:null,
browser:Module.prototype.browser,
id:null,
destroyEvent:null,
mouseOverEvent:null,
mouseOutEvent:null,
mouseDownEvent:null,
mouseUpEvent:null,
clickEvent:null,
keyPressEvent:null,
keyDownEvent:null,
keyUpEvent:null,
focusEvent:null,
blurEvent:null,
init:function(p_oObject,p_oConfig){
if(!this.SUBMENU_TYPE){
this.SUBMENU_TYPE=Menu;}
this.cfg=new YAHOO.util.Config(this);
this.initDefaultConfig();
var SIGNATURE=CustomEvent.LIST,
oConfig=this.cfg,
sURL="#",
oAnchor,
sTarget,
sText,
sId;
if(Lang.isString(p_oObject)){
this._createRootNodeStructure();
oConfig.queueProperty("text",p_oObject);}
else if(p_oObject&&p_oObject.tagName){
switch(p_oObject.tagName.toUpperCase()){
case"OPTION":
this._createRootNodeStructure();
oConfig.queueProperty("text",p_oObject.text);
oConfig.queueProperty("disabled",p_oObject.disabled);
this.value=p_oObject.value;
this.srcElement=p_oObject;
break;
case"OPTGROUP":
this._createRootNodeStructure();
oConfig.queueProperty("text",p_oObject.label);
oConfig.queueProperty("disabled",p_oObject.disabled);
this.srcElement=p_oObject;
this._initSubTree();
break;
case"LI":
oAnchor=Dom.getFirstChild(p_oObject);
if(oAnchor){
sURL=oAnchor.getAttribute("href",2);
sTarget=oAnchor.getAttribute("target");
sText=oAnchor.innerHTML;}
this.srcElement=p_oObject;
this.element=p_oObject;
this._oAnchor=oAnchor;
oConfig.setProperty("text",sText,true);
oConfig.setProperty("url",sURL,true);
oConfig.setProperty("target",sTarget,true);
this._initSubTree();
break;}}
if(this.element){
sId=(this.srcElement||this.element).id;
if(!sId){
sId=this.id||Dom.generateId();
this.element.id=sId;}
this.id=sId;
Dom.addClass(this.element,this.CSS_CLASS_NAME);
Dom.addClass(this._oAnchor,this.CSS_LABEL_CLASS_NAME);
this.mouseOverEvent=this.createEvent(EVENT_TYPES.MOUSE_OVER);
this.mouseOverEvent.signature=SIGNATURE;
this.mouseOutEvent=this.createEvent(EVENT_TYPES.MOUSE_OUT);
this.mouseOutEvent.signature=SIGNATURE;
this.mouseDownEvent=this.createEvent(EVENT_TYPES.MOUSE_DOWN);
this.mouseDownEvent.signature=SIGNATURE;
this.mouseUpEvent=this.createEvent(EVENT_TYPES.MOUSE_UP);
this.mouseUpEvent.signature=SIGNATURE;
this.clickEvent=this.createEvent(EVENT_TYPES.CLICK);
this.clickEvent.signature=SIGNATURE;
this.keyPressEvent=this.createEvent(EVENT_TYPES.KEY_PRESS);
this.keyPressEvent.signature=SIGNATURE;
this.keyDownEvent=this.createEvent(EVENT_TYPES.KEY_DOWN);
this.keyDownEvent.signature=SIGNATURE;
this.keyUpEvent=this.createEvent(EVENT_TYPES.KEY_UP);
this.keyUpEvent.signature=SIGNATURE;
this.focusEvent=this.createEvent(EVENT_TYPES.FOCUS);
this.focusEvent.signature=SIGNATURE;
this.blurEvent=this.createEvent(EVENT_TYPES.BLUR);
this.blurEvent.signature=SIGNATURE;
this.destroyEvent=this.createEvent(EVENT_TYPES.DESTROY);
this.destroyEvent.signature=SIGNATURE;
if(p_oConfig){
oConfig.applyConfig(p_oConfig);}
oConfig.fireQueue();}},
_createRootNodeStructure:function(){
var oElement,
oAnchor;
if(!m_oMenuItemTemplate){
m_oMenuItemTemplate=document.createElement("li");
m_oMenuItemTemplate.innerHTML="<a href=\"#\"></a>";}
oElement=m_oMenuItemTemplate.cloneNode(true);
oElement.className=this.CSS_CLASS_NAME;
oAnchor=oElement.firstChild;
oAnchor.className=this.CSS_LABEL_CLASS_NAME;
this.element=oElement;
this._oAnchor=oAnchor;},
_initSubTree:function(){
var oSrcEl=this.srcElement,
oConfig=this.cfg,
oNode,
aOptions,
nOptions,
oMenu,
n;
if(oSrcEl.childNodes.length>0){
if(this.parent.lazyLoad&&this.parent.srcElement&&
this.parent.srcElement.tagName.toUpperCase()=="SELECT"){
oConfig.setProperty("submenu",
{id:Dom.generateId(),itemdata:oSrcEl.childNodes});}
else{
oNode=oSrcEl.firstChild;
aOptions=[];
do{
if(oNode&&oNode.tagName){
switch(oNode.tagName.toUpperCase()){
case"DIV":
oConfig.setProperty("submenu",oNode);
break;
case"OPTION":
aOptions[aOptions.length]=oNode;
break;}}}
while((oNode=oNode.nextSibling));
nOptions=aOptions.length;
if(nOptions>0){
oMenu=new this.SUBMENU_TYPE(Dom.generateId());
oConfig.setProperty("submenu",oMenu);
for(n=0;n<nOptions;n++){
oMenu.addItem((new oMenu.ITEM_TYPE(aOptions[n])));}}}}},
configText:function(p_sType,p_aArgs,p_oItem){
var sText=p_aArgs[0],
oConfig=this.cfg,
oAnchor=this._oAnchor,
sHelpText=oConfig.getProperty("helptext"),
sHelpTextHTML="",
sEmphasisStartTag="",
sEmphasisEndTag="";
if(sText){
if(sHelpText){
sHelpTextHTML="<em class=\"helptext\">"+sHelpText+"</em>";}
if(oConfig.getProperty("emphasis")){
sEmphasisStartTag="<em>";
sEmphasisEndTag="</em>";}
if(oConfig.getProperty("strongemphasis")){
sEmphasisStartTag="<strong>";
sEmphasisEndTag="</strong>";}
oAnchor.innerHTML=(sEmphasisStartTag+sText+
sEmphasisEndTag+sHelpTextHTML);}},
configHelpText:function(p_sType,p_aArgs,p_oItem){
this.cfg.refireEvent("text");},
configURL:function(p_sType,p_aArgs,p_oItem){
var sURL=p_aArgs[0];
if(!sURL){
sURL="#";}
var oAnchor=this._oAnchor;
if(YAHOO.env.ua.opera){
oAnchor.removeAttribute("href");}
oAnchor.setAttribute("href",sURL);},
configTarget:function(p_sType,p_aArgs,p_oItem){
var sTarget=p_aArgs[0],
oAnchor=this._oAnchor;
if(sTarget&&sTarget.length>0){
oAnchor.setAttribute("target",sTarget);}
else{
oAnchor.removeAttribute("target");}},
configEmphasis:function(p_sType,p_aArgs,p_oItem){
var bEmphasis=p_aArgs[0],
oConfig=this.cfg;
if(bEmphasis&&oConfig.getProperty("strongemphasis")){
oConfig.setProperty("strongemphasis",false);}
oConfig.refireEvent("text");},
configStrongEmphasis:function(p_sType,p_aArgs,p_oItem){
var bStrongEmphasis=p_aArgs[0],
oConfig=this.cfg;
if(bStrongEmphasis&&oConfig.getProperty("emphasis")){
oConfig.setProperty("emphasis",false);}
oConfig.refireEvent("text");},
configChecked:function(p_sType,p_aArgs,p_oItem){
var bChecked=p_aArgs[0],
oElement=this.element,
oAnchor=this._oAnchor,
oConfig=this.cfg,
sState="-checked",
sClassName=this.CSS_CLASS_NAME+sState,
sLabelClassName=this.CSS_LABEL_CLASS_NAME+sState;
if(bChecked){
Dom.addClass(oElement,sClassName);
Dom.addClass(oAnchor,sLabelClassName);}
else{
Dom.removeClass(oElement,sClassName);
Dom.removeClass(oAnchor,sLabelClassName);}
oConfig.refireEvent("text");
if(oConfig.getProperty("disabled")){
oConfig.refireEvent("disabled");}
if(oConfig.getProperty("selected")){
oConfig.refireEvent("selected");}},
configDisabled:function(p_sType,p_aArgs,p_oItem){
var bDisabled=p_aArgs[0],
oConfig=this.cfg,
oSubmenu=oConfig.getProperty("submenu"),
bChecked=oConfig.getProperty("checked"),
oElement=this.element,
oAnchor=this._oAnchor,
sState="-disabled",
sCheckedState="-checked"+sState,
sSubmenuState="-hassubmenu"+sState,
sClassName=this.CSS_CLASS_NAME+sState,
sLabelClassName=this.CSS_LABEL_CLASS_NAME+sState,
sCheckedClassName=this.CSS_CLASS_NAME+sCheckedState,
sLabelCheckedClassName=this.CSS_LABEL_CLASS_NAME+sCheckedState,
sSubmenuClassName=this.CSS_CLASS_NAME+sSubmenuState,
sLabelSubmenuClassName=this.CSS_LABEL_CLASS_NAME+sSubmenuState;
if(bDisabled){
if(oConfig.getProperty("selected")){
oConfig.setProperty("selected",false);}
Dom.addClass(oElement,sClassName);
Dom.addClass(oAnchor,sLabelClassName);
if(oSubmenu){
Dom.addClass(oElement,sSubmenuClassName);
Dom.addClass(oAnchor,sLabelSubmenuClassName);}
if(bChecked){
Dom.addClass(oElement,sCheckedClassName);
Dom.addClass(oAnchor,sLabelCheckedClassName);}}
else{
Dom.removeClass(oElement,sClassName);
Dom.removeClass(oAnchor,sLabelClassName);
if(oSubmenu){
Dom.removeClass(oElement,sSubmenuClassName);
Dom.removeClass(oAnchor,sLabelSubmenuClassName);}
if(bChecked){
Dom.removeClass(oElement,sCheckedClassName);
Dom.removeClass(oAnchor,sLabelCheckedClassName);}}},
configSelected:function(p_sType,p_aArgs,p_oItem){
var oConfig=this.cfg,
bSelected=p_aArgs[0],
oElement=this.element,
oAnchor=this._oAnchor,
bChecked=oConfig.getProperty("checked"),
oSubmenu=oConfig.getProperty("submenu"),
sState="-selected",
sCheckedState="-checked"+sState,
sSubmenuState="-hassubmenu"+sState,
sClassName=this.CSS_CLASS_NAME+sState,
sLabelClassName=this.CSS_LABEL_CLASS_NAME+sState,
sCheckedClassName=this.CSS_CLASS_NAME+sCheckedState,
sLabelCheckedClassName=this.CSS_LABEL_CLASS_NAME+sCheckedState,
sSubmenuClassName=this.CSS_CLASS_NAME+sSubmenuState,
sLabelSubmenuClassName=this.CSS_LABEL_CLASS_NAME+sSubmenuState;
if(YAHOO.env.ua.opera){
oAnchor.blur();}
if(bSelected&&!oConfig.getProperty("disabled")){
Dom.addClass(oElement,sClassName);
Dom.addClass(oAnchor,sLabelClassName);
if(oSubmenu){
Dom.addClass(oElement,sSubmenuClassName);
Dom.addClass(oAnchor,sLabelSubmenuClassName);}
if(bChecked){
Dom.addClass(oElement,sCheckedClassName);
Dom.addClass(oAnchor,sLabelCheckedClassName);}}
else{
Dom.removeClass(oElement,sClassName);
Dom.removeClass(oAnchor,sLabelClassName);
if(oSubmenu){
Dom.removeClass(oElement,sSubmenuClassName);
Dom.removeClass(oAnchor,sLabelSubmenuClassName);}
if(bChecked){
Dom.removeClass(oElement,sCheckedClassName);
Dom.removeClass(oAnchor,sLabelCheckedClassName);}}
if(this.hasFocus()&&YAHOO.env.ua.opera){
oAnchor.focus();}},
_onSubmenuBeforeHide:function(p_sType,p_aArgs){
var oItem=this.parent,
oMenu;
function onHide(){
oItem._oAnchor.blur();
oMenu.beforeHideEvent.unsubscribe(onHide);}
if(oItem.hasFocus()){
oMenu=oItem.parent;
oMenu.beforeHideEvent.subscribe(onHide);}},
configSubmenu:function(p_sType,p_aArgs,p_oItem){
var oSubmenu=p_aArgs[0],
oConfig=this.cfg,
oElement=this.element,
oAnchor=this._oAnchor,
bLazyLoad=this.parent&&this.parent.lazyLoad,
sState="-hassubmenu",
sClassName=this.CSS_CLASS_NAME+sState,
sLabelClassName=this.CSS_LABEL_CLASS_NAME+sState,
oMenu,
sSubmenuId,
oSubmenuConfig;
if(oSubmenu){
if(oSubmenu instanceof Menu){
oMenu=oSubmenu;
oMenu.parent=this;
oMenu.lazyLoad=bLazyLoad;}
else if(typeof oSubmenu=="object"&&oSubmenu.id&&!oSubmenu.nodeType){
sSubmenuId=oSubmenu.id;
oSubmenuConfig=oSubmenu;
oSubmenuConfig.lazyload=bLazyLoad;
oSubmenuConfig.parent=this;
oMenu=new this.SUBMENU_TYPE(sSubmenuId,oSubmenuConfig);
oConfig.setProperty("submenu",oMenu,true);}
else{
oMenu=new this.SUBMENU_TYPE(oSubmenu,
{lazyload:bLazyLoad,parent:this});
oConfig.setProperty("submenu",oMenu,true);}
if(oMenu){
Dom.addClass(oElement,sClassName);
Dom.addClass(oAnchor,sLabelClassName);
this._oSubmenu=oMenu;
if(YAHOO.env.ua.opera){
oMenu.beforeHideEvent.subscribe(this._onSubmenuBeforeHide);}}}
else{
Dom.removeClass(oElement,sClassName);
Dom.removeClass(oAnchor,sLabelClassName);
if(this._oSubmenu){
this._oSubmenu.destroy();}}
if(oConfig.getProperty("disabled")){
oConfig.refireEvent("disabled");}
if(oConfig.getProperty("selected")){
oConfig.refireEvent("selected");}},
configOnClick:function(p_sType,p_aArgs,p_oItem){
var oObject=p_aArgs[0];
if(this._oOnclickAttributeValue&&
(this._oOnclickAttributeValue!=oObject)){
this.clickEvent.unsubscribe(this._oOnclickAttributeValue.fn,
this._oOnclickAttributeValue.obj);
this._oOnclickAttributeValue=null;}
if(!this._oOnclickAttributeValue&&typeof oObject=="object"&&
typeof oObject.fn=="function"){
this.clickEvent.subscribe(oObject.fn,
((!YAHOO.lang.isUndefined(oObject.obj))?oObject.obj:this),
oObject.scope);
this._oOnclickAttributeValue=oObject;}},
configClassName:function(p_sType,p_aArgs,p_oItem){
var sClassName=p_aArgs[0];
if(this._sClassName){
Dom.removeClass(this.element,this._sClassName);}
Dom.addClass(this.element,sClassName);
this._sClassName=sClassName;},
initDefaultConfig:function(){
var oConfig=this.cfg;
oConfig.addProperty(
DEFAULT_CONFIG.TEXT.key,
{
handler:this.configText,
value:DEFAULT_CONFIG.TEXT.value,
validator:DEFAULT_CONFIG.TEXT.validator,
suppressEvent:DEFAULT_CONFIG.TEXT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.HELP_TEXT.key,
{
handler:this.configHelpText,
supercedes:DEFAULT_CONFIG.HELP_TEXT.supercedes,
suppressEvent:DEFAULT_CONFIG.HELP_TEXT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.URL.key,
{
handler:this.configURL,
value:DEFAULT_CONFIG.URL.value,
suppressEvent:DEFAULT_CONFIG.URL.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.TARGET.key,
{
handler:this.configTarget,
suppressEvent:DEFAULT_CONFIG.TARGET.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.EMPHASIS.key,
{
handler:this.configEmphasis,
value:DEFAULT_CONFIG.EMPHASIS.value,
validator:DEFAULT_CONFIG.EMPHASIS.validator,
suppressEvent:DEFAULT_CONFIG.EMPHASIS.suppressEvent,
supercedes:DEFAULT_CONFIG.EMPHASIS.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.STRONG_EMPHASIS.key,
{
handler:this.configStrongEmphasis,
value:DEFAULT_CONFIG.STRONG_EMPHASIS.value,
validator:DEFAULT_CONFIG.STRONG_EMPHASIS.validator,
suppressEvent:DEFAULT_CONFIG.STRONG_EMPHASIS.suppressEvent,
supercedes:DEFAULT_CONFIG.STRONG_EMPHASIS.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.CHECKED.key,
{
handler:this.configChecked,
value:DEFAULT_CONFIG.CHECKED.value,
validator:DEFAULT_CONFIG.CHECKED.validator,
suppressEvent:DEFAULT_CONFIG.CHECKED.suppressEvent,
supercedes:DEFAULT_CONFIG.CHECKED.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.DISABLED.key,
{
handler:this.configDisabled,
value:DEFAULT_CONFIG.DISABLED.value,
validator:DEFAULT_CONFIG.DISABLED.validator,
suppressEvent:DEFAULT_CONFIG.DISABLED.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.SELECTED.key,
{
handler:this.configSelected,
value:DEFAULT_CONFIG.SELECTED.value,
validator:DEFAULT_CONFIG.SELECTED.validator,
suppressEvent:DEFAULT_CONFIG.SELECTED.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.SUBMENU.key,
{
handler:this.configSubmenu,
supercedes:DEFAULT_CONFIG.SUBMENU.supercedes,
suppressEvent:DEFAULT_CONFIG.SUBMENU.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.ONCLICK.key,
{
handler:this.configOnClick,
suppressEvent:DEFAULT_CONFIG.ONCLICK.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.CLASS_NAME.key,
{
handler:this.configClassName,
value:DEFAULT_CONFIG.CLASS_NAME.value,
validator:DEFAULT_CONFIG.CLASS_NAME.validator,
suppressEvent:DEFAULT_CONFIG.CLASS_NAME.suppressEvent});},
getNextEnabledSibling:function(){
var nGroupIndex,
aItemGroups,
oNextItem,
nNextGroupIndex,
aNextGroup;
function getNextArrayItem(p_aArray,p_nStartIndex){
return p_aArray[p_nStartIndex]||
getNextArrayItem(p_aArray,(p_nStartIndex+1));}
if(this.parent instanceof Menu){
nGroupIndex=this.groupIndex;
aItemGroups=this.parent.getItemGroups();
if(this.index<(aItemGroups[nGroupIndex].length-1)){
oNextItem=getNextArrayItem(aItemGroups[nGroupIndex],
(this.index+1));}
else{
if(nGroupIndex<(aItemGroups.length-1)){
nNextGroupIndex=nGroupIndex+1;}
else{
nNextGroupIndex=0;}
aNextGroup=getNextArrayItem(aItemGroups,nNextGroupIndex);
oNextItem=getNextArrayItem(aNextGroup,0);}
return(oNextItem.cfg.getProperty("disabled")||
oNextItem.element.style.display=="none")?
oNextItem.getNextEnabledSibling():oNextItem;}},
getPreviousEnabledSibling:function(){
var nGroupIndex,
aItemGroups,
oPreviousItem,
nPreviousGroupIndex,
aPreviousGroup;
function getPreviousArrayItem(p_aArray,p_nStartIndex){
return p_aArray[p_nStartIndex]||
getPreviousArrayItem(p_aArray,(p_nStartIndex-1));}
function getFirstItemIndex(p_aArray,p_nStartIndex){
return p_aArray[p_nStartIndex]?p_nStartIndex:
getFirstItemIndex(p_aArray,(p_nStartIndex+1));}
if(this.parent instanceof Menu){
nGroupIndex=this.groupIndex;
aItemGroups=this.parent.getItemGroups();
if(this.index>getFirstItemIndex(aItemGroups[nGroupIndex],0)){
oPreviousItem=getPreviousArrayItem(aItemGroups[nGroupIndex],
(this.index-1));}
else{
if(nGroupIndex>getFirstItemIndex(aItemGroups,0)){
nPreviousGroupIndex=nGroupIndex-1;}
else{
nPreviousGroupIndex=aItemGroups.length-1;}
aPreviousGroup=getPreviousArrayItem(aItemGroups,
nPreviousGroupIndex);
oPreviousItem=getPreviousArrayItem(aPreviousGroup,
(aPreviousGroup.length-1));}
return(oPreviousItem.cfg.getProperty("disabled")||
oPreviousItem.element.style.display=="none")?
oPreviousItem.getPreviousEnabledSibling():oPreviousItem;}},
focus:function(){
var oParent=this.parent,
oAnchor=this._oAnchor,
oActiveItem=oParent.activeItem,
me=this;
function setFocus(){
try{
if(YAHOO.env.ua.ie&&!document.hasFocus()){
return;}
if(oActiveItem){
oActiveItem.blurEvent.fire();}
oAnchor.focus();
me.focusEvent.fire();}
catch(e){}}
if(!this.cfg.getProperty("disabled")&&oParent&&
oParent.cfg.getProperty("visible")&&
this.element.style.display!="none"){
window.setTimeout(setFocus,0);}},
blur:function(){
var oParent=this.parent;
if(!this.cfg.getProperty("disabled")&&oParent&&
oParent.cfg.getProperty("visible")){
var me=this;
window.setTimeout(function(){
try{
me._oAnchor.blur();
me.blurEvent.fire();}
catch(e){}},0);}},
hasFocus:function(){
return(YAHOO.widget.MenuManager.getFocusedMenuItem()==this);},
destroy:function(){
var oEl=this.element,
oSubmenu,
oParentNode;
if(oEl){
oSubmenu=this.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.destroy();}
this.mouseOverEvent.unsubscribeAll();
this.mouseOutEvent.unsubscribeAll();
this.mouseDownEvent.unsubscribeAll();
this.mouseUpEvent.unsubscribeAll();
this.clickEvent.unsubscribeAll();
this.keyPressEvent.unsubscribeAll();
this.keyDownEvent.unsubscribeAll();
this.keyUpEvent.unsubscribeAll();
this.focusEvent.unsubscribeAll();
this.blurEvent.unsubscribeAll();
this.cfg.configChangedEvent.unsubscribeAll();
oParentNode=oEl.parentNode;
if(oParentNode){
oParentNode.removeChild(oEl);
this.destroyEvent.fire();}
this.destroyEvent.unsubscribeAll();}},
toString:function(){
var sReturnVal="MenuItem",
sId=this.id;
if(sId){
sReturnVal+=(" "+sId);}
return sReturnVal;}};
Lang.augmentProto(MenuItem,YAHOO.util.EventProvider);})();
(function(){
YAHOO.widget.ContextMenu=function(p_oElement,p_oConfig){
YAHOO.widget.ContextMenu.superclass.constructor.call(this,
p_oElement,p_oConfig);};
var Event=YAHOO.util.Event,
ContextMenu=YAHOO.widget.ContextMenu,
EVENT_TYPES={"TRIGGER_CONTEXT_MENU":"triggerContextMenu","CONTEXT_MENU":(YAHOO.env.ua.opera?"mousedown":"contextmenu"),"CLICK":"click"},
DEFAULT_CONFIG={"TRIGGER":{
key:"trigger",
suppressEvent:true}};
function position(p_sType,p_aArgs,p_aPos){
this.cfg.setProperty("xy",p_aPos);
this.beforeShowEvent.unsubscribe(position,p_aPos);}
YAHOO.lang.extend(ContextMenu,YAHOO.widget.Menu,{
_oTrigger:null,
_bCancelled:false,
contextEventTarget:null,
triggerContextMenuEvent:null,
init:function(p_oElement,p_oConfig){
ContextMenu.superclass.init.call(this,p_oElement);
this.beforeInitEvent.fire(ContextMenu);
if(p_oConfig){
this.cfg.applyConfig(p_oConfig,true);}
this.initEvent.fire(ContextMenu);},
initEvents:function(){
ContextMenu.superclass.initEvents.call(this);
this.triggerContextMenuEvent=
this.createEvent(EVENT_TYPES.TRIGGER_CONTEXT_MENU);
this.triggerContextMenuEvent.signature=YAHOO.util.CustomEvent.LIST;},
cancel:function(){
this._bCancelled=true;},
_removeEventHandlers:function(){
var oTrigger=this._oTrigger;
if(oTrigger){
Event.removeListener(oTrigger,EVENT_TYPES.CONTEXT_MENU,
this._onTriggerContextMenu);
if(YAHOO.env.ua.opera){
Event.removeListener(oTrigger,EVENT_TYPES.CLICK,
this._onTriggerClick);}}},
_onTriggerClick:function(p_oEvent,p_oMenu){
if(p_oEvent.ctrlKey){
Event.stopEvent(p_oEvent);}},
_onTriggerContextMenu:function(p_oEvent,p_oMenu){
if(p_oEvent.type=="mousedown"&&!p_oEvent.ctrlKey){
return;}
var aXY;
Event.stopEvent(p_oEvent);
this.contextEventTarget=Event.getTarget(p_oEvent);
this.triggerContextMenuEvent.fire(p_oEvent);
YAHOO.widget.MenuManager.hideVisible();
if(!this._bCancelled){
aXY=Event.getXY(p_oEvent);
if(!YAHOO.util.Dom.inDocument(this.element)){
this.beforeShowEvent.subscribe(position,aXY);}
else{
this.cfg.setProperty("xy",aXY);}
this.show();}
this._bCancelled=false;},
toString:function(){
var sReturnVal="ContextMenu",
sId=this.id;
if(sId){
sReturnVal+=(" "+sId);}
return sReturnVal;},
initDefaultConfig:function(){
ContextMenu.superclass.initDefaultConfig.call(this);
this.cfg.addProperty(DEFAULT_CONFIG.TRIGGER.key,
{
handler:this.configTrigger,
suppressEvent:DEFAULT_CONFIG.TRIGGER.suppressEvent});},
destroy:function(){
this._removeEventHandlers();
ContextMenu.superclass.destroy.call(this);},
configTrigger:function(p_sType,p_aArgs,p_oMenu){
var oTrigger=p_aArgs[0];
if(oTrigger){
if(this._oTrigger){
this._removeEventHandlers();}
this._oTrigger=oTrigger;
Event.on(oTrigger,EVENT_TYPES.CONTEXT_MENU,
this._onTriggerContextMenu,this,true);
if(YAHOO.env.ua.opera){
Event.on(oTrigger,EVENT_TYPES.CLICK,this._onTriggerClick,
this,true);}}
else{
this._removeEventHandlers();}}});}());
YAHOO.widget.ContextMenuItem=YAHOO.widget.MenuItem;
(function(){
YAHOO.widget.MenuBar=function(p_oElement,p_oConfig){
YAHOO.widget.MenuBar.superclass.constructor.call(this,
p_oElement,p_oConfig);};
function checkPosition(p_sPosition){
if(typeof p_sPosition=="string"){
return("dynamic,static".indexOf((p_sPosition.toLowerCase()))!=-1);}}
var Event=YAHOO.util.Event,
MenuBar=YAHOO.widget.MenuBar,
DEFAULT_CONFIG={"POSITION":{
key:"position",
value:"static",
validator:checkPosition,
supercedes:["visible"]},"SUBMENU_ALIGNMENT":{
key:"submenualignment",
value:["tl","bl"],
suppressEvent:true},"AUTO_SUBMENU_DISPLAY":{
key:"autosubmenudisplay",
value:false,
validator:YAHOO.lang.isBoolean,
suppressEvent:true}};
YAHOO.lang.extend(MenuBar,YAHOO.widget.Menu,{
init:function(p_oElement,p_oConfig){
if(!this.ITEM_TYPE){
this.ITEM_TYPE=YAHOO.widget.MenuBarItem;}
MenuBar.superclass.init.call(this,p_oElement);
this.beforeInitEvent.fire(MenuBar);
if(p_oConfig){
this.cfg.applyConfig(p_oConfig,true);}
this.initEvent.fire(MenuBar);},
CSS_CLASS_NAME:"yuimenubar",
_onKeyDown:function(p_sType,p_aArgs,p_oMenuBar){
var oEvent=p_aArgs[0],
oItem=p_aArgs[1],
oSubmenu,
oItemCfg,
oNextItem;
if(oItem&&!oItem.cfg.getProperty("disabled")){
oItemCfg=oItem.cfg;
switch(oEvent.keyCode){
case 37:
case 39:
if(oItem==this.activeItem&&!oItemCfg.getProperty("selected")){
oItemCfg.setProperty("selected",true);}
else{
oNextItem=(oEvent.keyCode==37)?
oItem.getPreviousEnabledSibling():
oItem.getNextEnabledSibling();
if(oNextItem){
this.clearActiveItem();
oNextItem.cfg.setProperty("selected",true);
if(this.cfg.getProperty("autosubmenudisplay")){
oSubmenu=oNextItem.cfg.getProperty("submenu");
if(oSubmenu){
oSubmenu.show();}}
oNextItem.focus();}}
Event.preventDefault(oEvent);
break;
case 40:
if(this.activeItem!=oItem){
this.clearActiveItem();
oItemCfg.setProperty("selected",true);
oItem.focus();}
oSubmenu=oItemCfg.getProperty("submenu");
if(oSubmenu){
if(oSubmenu.cfg.getProperty("visible")){
oSubmenu.setInitialSelection();
oSubmenu.setInitialFocus();}
else{
oSubmenu.show();}}
Event.preventDefault(oEvent);
break;}}
if(oEvent.keyCode==27&&this.activeItem){
oSubmenu=this.activeItem.cfg.getProperty("submenu");
if(oSubmenu&&oSubmenu.cfg.getProperty("visible")){
oSubmenu.hide();
this.activeItem.focus();}
else{
this.activeItem.cfg.setProperty("selected",false);
this.activeItem.blur();}
Event.preventDefault(oEvent);}},
_onClick:function(p_sType,p_aArgs,p_oMenuBar){
MenuBar.superclass._onClick.call(this,p_sType,p_aArgs,p_oMenuBar);
var oItem=p_aArgs[1],
oEvent,
oTarget,
oActiveItem,
oConfig,
oSubmenu;
if(oItem&&!oItem.cfg.getProperty("disabled")){
oEvent=p_aArgs[0];
oTarget=Event.getTarget(oEvent);
oActiveItem=this.activeItem;
oConfig=this.cfg;
if(oActiveItem&&oActiveItem!=oItem){
this.clearActiveItem();}
oItem.cfg.setProperty("selected",true);
oSubmenu=oItem.cfg.getProperty("submenu");
if(oSubmenu){
if(oSubmenu.cfg.getProperty("visible")){
oSubmenu.hide();}
else{
oSubmenu.show();}}}},
toString:function(){
var sReturnVal="MenuBar",
sId=this.id;
if(sId){
sReturnVal+=(" "+sId);}
return sReturnVal;},
initDefaultConfig:function(){
MenuBar.superclass.initDefaultConfig.call(this);
var oConfig=this.cfg;
oConfig.addProperty(
DEFAULT_CONFIG.POSITION.key,
{
handler:this.configPosition,
value:DEFAULT_CONFIG.POSITION.value,
validator:DEFAULT_CONFIG.POSITION.validator,
supercedes:DEFAULT_CONFIG.POSITION.supercedes});
oConfig.addProperty(
DEFAULT_CONFIG.SUBMENU_ALIGNMENT.key,
{
value:DEFAULT_CONFIG.SUBMENU_ALIGNMENT.value,
suppressEvent:DEFAULT_CONFIG.SUBMENU_ALIGNMENT.suppressEvent});
oConfig.addProperty(
DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.key,
{
value:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.value,
validator:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.validator,
suppressEvent:DEFAULT_CONFIG.AUTO_SUBMENU_DISPLAY.suppressEvent});}});}());
YAHOO.widget.MenuBarItem=function(p_oObject,p_oConfig){
YAHOO.widget.MenuBarItem.superclass.constructor.call(this,
p_oObject,p_oConfig);};
YAHOO.lang.extend(YAHOO.widget.MenuBarItem,YAHOO.widget.MenuItem,{
init:function(p_oObject,p_oConfig){
if(!this.SUBMENU_TYPE){
this.SUBMENU_TYPE=YAHOO.widget.Menu;}
YAHOO.widget.MenuBarItem.superclass.init.call(this,p_oObject);
var oConfig=this.cfg;
if(p_oConfig){
oConfig.applyConfig(p_oConfig,true);}
oConfig.fireQueue();},
CSS_CLASS_NAME:"yuimenubaritem",
CSS_LABEL_CLASS_NAME:"yuimenubaritemlabel",
toString:function(){
var sReturnVal="MenuBarItem";
if(this.cfg&&this.cfg.getProperty("text")){
sReturnVal+=(": "+this.cfg.getProperty("text"));}
return sReturnVal;}});
YAHOO.register("menu",YAHOO.widget.Menu,{version:"2.5.1",build:"984"});// JScript File

function SignInModalPopUp()
{
      
    //document.getElementById('txtName').focus();
    document.getElementById('txtName').value="";    
    document.getElementById('txtEmail').value="";
    document.getElementById('txtLNm').value="";
    document.getElementById('txtCreatePW').value="";
    document.getElementById('txtConfPW').value="";
    document.getElementById('txtJPHandphone').value="";
    document.getElementById('chkNewLetter0').checked=false;
    document.getElementById('chkNewLetter').checked=false;
    $find('modpopSignUp').show();
    document.getElementById('divWizardStep2a').style.display="block";
    document.getElementById('divWizardStep2b').style.display="none";
    document.getElementById('txtName').focus();
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}
function SignUpModalPopUp()
{

    //document.getElementById('txtUserName').focus();
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    
    $find('modpopSignUp').show();
    document.getElementById('divWizardStep2a').style.display="none";
    document.getElementById('divWizardStep2b').style.display="block";
    document.getElementById('txtUserName').focus();
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.visibility="hidden";
         //document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}

//for preauthenticated pop up sign in
function ForgetPwdPreAuthenticated()
{
    document.getElementById('cnfrm').style.display="none";
    document.getElementById('divFpwdLdr').style.display="none";
    document.getElementById('idCon').style.display="block";
    $find('mpopforget').show();
    document.getElementById('ctl00_signUp_txtUserid').focus();
    document.getElementById('ctl00_signUp_txtUserid').value="";
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
//    return false;
}
function SignUpModalPopUp1()
{
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    document.getElementById('ctl00_cph_divSignupDiv').style.display="block";
    document.getElementById('ctl00_cph_divSignINDiv').style.display="none";

    document.getElementById('txtUserName').focus();
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
}
function SignInModalPopUp1()
{
    document.getElementById('txtUserName').value="";
    document.getElementById('txtPW').value="";
    document.getElementById('ctl00_cph_divSignupDiv').style.display="none";
    document.getElementById('ctl00_cph_divSignINDiv').style.display="block";

    document.getElementById('txtUserName').focus();
    document.getElementById('FlexGallery').style.visibility="hidden";
    document.getElementById('flexCus').style.visibility="hidden";
    document.getElementById('mainDivFlex').style.visibility="hidden";
}

//ends here


function HideFlexPopUp()
{
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.visibility="visible";
         //document.getElementById('flexCus').style.visibility="visible";
         document.getElementById('FlexGallery').style.visibility="visible";
         document.getElementById('flexCus').style.visibility="visible";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}

function ForgetPwdModalPopUp()
{
    $find('modpopSignUp').hide();
    document.getElementById('cnfrm').style.display="none";
    document.getElementById('divFpwdLdr').style.display="none";
    document.getElementById('idCon').style.display="block";
    $find('mpopforget').show();
     document.getElementById('ctl00_signUp_txtUserid').focus();
    document.getElementById('ctl00_signUp_txtUserid').value="";
   //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
         document.getElementById('mainDivFlex').style.visibility="hidden";
      //} 
    return false;
}


/* SatS on Dec_05_2007  */

function mfnLoginLogout()
{    
//Commented for now
    var DivLogout =  document.getElementById("divLogout");
    var DivLoader =  document.getElementById("divLogoutLoader");
    DivLoader.style.display = "block";          
    DivLogout.style.display = "none";
    SignUp.gfnLoginLogout("Login", onLoginLogoutSuccess, onLoginLogoutTimeout, onLoginLogoutFailure);             
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    //{ 
        document.getElementById('FlexGallery').style.visibility="visible";
        document.getElementById('flexCus').style.visibility="visible";
        document.getElementById('mainDivFlex').style.visibility="visible";
        
        
     //} 
  }

function onShowUsrOption()
{
    try
    {  
          document.getElementById("ctl00_lnkUpload").href = "/myspace/createalbum.aspx" ;  
          if(txtEmpty('ctl00_hdnToRedirect'))
          {
             var lstrToRedirect = document.getElementById('ctl00_hdnToRedirect').value;
             document.getElementById('ctl00_hdnToRedirect').value = "";
             window.location = lstrToRedirect;            
          }
             
     }
    catch(ex)
    {
      alert(ex);
    }   
}
/*          END OF STATEMENT        */
function validationSignup()
{     if(!txtEmpty('txtName'))
    {        
        Jalert("Enter first name");
        document.getElementById('txtName').focus();
        return false;
    }
    
//    if(isNaN(txtName.value))
//   {
//     Jalert("Invalid data format.\n\nOnly numbers are allowed.");
//     document.getElementById('txtName').focus();
//     return false;
//   }
   
     if(document.getElementById('txtName').value.length < 4)
    {
        Jalert("Enter a name with atleast four characters");
        document.getElementById('txtName').focus();        
        return false;   
    }     
     if(!txtEmpty('txtEmail'))
    {
        document.getElementById('txtEmail').focus();
        Jalert("Enter a valid email id");
        return false;
    }
    
//    if(document.getElementById('txtEmail').value.length > 30)
//    {
//        Jalert("Email should not exceed more than 30 characters");
//        document.getElementById('txtEmail').focus();        
//        return false;   
//    }     

    if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('txtEmail').value))
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('txtEmail').focus();
        return false;
    }       
     if(!txtEmpty('txtCreatePW'))
    {        
        Jalert("Enter password");
        document.getElementById('txtCreatePW').focus();
        return false;
    }
    if(document.getElementById('txtCreatePW').value.length < 4)
    {
        Jalert("Enter a password with atleast four characters");
        document.getElementById('txtCreatePW').focus();        
        return false;   
    }
      
    if(!txtEmpty('txtConfPW'))
    {        
        Jalert("Enter confirm password");
        document.getElementById('txtConfPW').focus();
        return false;
    }
    if(!txtChkPass('txtCreatePW','txtConfPW'))
    {        
        Jalert("Password and confirm password must be equal");
        document.getElementById('txtCreatePW').focus();
        return false;
    }        
    if(!checkCheckBoxes('chkNewLetter'))
    {        
        Jalert("Terms and conditions should be accepted to enter");
        document.getElementById('chkNewLetter').focus();
        return false;
    }   
  
    signup.gfnSignUp( document.getElementById('txtEmail').value,document.getElementById('txtName').value,"",document.getElementById('txtCreatePW').value,false,false,document.getElementById('chkNewLetter').checked,document.getElementById('txtJPHandphone').value, onfsignUPSuccess, onfSignUpLoadTimeout,onfSignUpFailure);   
    return false;
}
function onfsignUPSuccess(result, eventArgs)
{
//     mfnLoginLogout() ;
//     SUPopCancel() ;
//     onShowUsrOption(result) ;
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divSignUpMessage");
        DivLoader.style.display = "block" ; 
        document.getElementById("ctl00_HPHeader_QA_signin").style.display="none";
        document.getElementById("ctl00_HPHeader_QA_signout").style.display="block"; 
        document.getElementById("ctl00_HPHeader_QA_imgJoin").style.display="none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
        $find('modpopSignUp').hide();
        var DivSignUpWell =  document.getElementById("divWizardStep2b");
        DivSignUpWell.style.display = "block";         
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
        //} 
        signup.gfnGetUserFirstName(onSignUpUserFirstNameSuccess, onfSignUpLoadTimeout,onfSignUpFailure);   
    }
    
}
function onfSignUpLoadTimeout(result)
{
 
}

function onfSignUpFailure(result)
{
    var DivLoader =  document.getElementById("divSignUpMessage");
    DivLoader.style.display = "block" ;    
}

function mfnSigninFromPhotoContest(o)
{
    signup.gfnSignIn(o.username,o.password, onSignINSuccess, onSignInLoadTimeout,onSignInFailure);  
   
}

/*this is for signIn module  */
function validationSignIn()
{
    if(!txtEmpty('txtUserName'))
    {        
        Jalert("Enter your email id");
        document.getElementById('txtUserName').focus();
        return false;
    }
    
    if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('txtUserName').value))
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('txtUserName').focus();
        return false;
    }
    
    if(document.getElementById('txtPW').value.length < 4)
    {
        Jalert("Enter password");
        document.getElementById('txtPW').focus();        
        return false;   
    }
     signup.gfnSignIn(document.getElementById('txtUserName').value,document.getElementById('txtPW').value, onSignINSuccess, onSignInLoadTimeout,onSignInFailure);   
    
     return false;
}
function onSignINSuccess(result, eventArgs)
{
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "block" ; 
        var spanMsg=document.getElementById("lnkppngLogin");
        spanMsg.innerHTML= "Invalid user details";       
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
        // if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
    
        $find('modpopSignUp').hide();
        //Jalert('Check1');
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
      // { 
       
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
      //} 
         
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "none" ; 
         var DivSignUpWell =  document.getElementById("divWizardStep2a");
         DivSignUpWell.style.display = "block";   
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
        signup.gfnGetUserFirstName(onSignUpUserFirstNameSuccess, onfSignUpLoadTimeout,onfSignUpFailure);  
      // Jalert('Check2');
       
    }
}

function onSignUpUserFirstNameSuccess(result, eventArgs)
{
    
    document.getElementById('ctl00_Header_QA_welcomeTxtSpan').innerHTML="Welcome "+result;
    var divQuickLinkID =  document.getElementById("ctl00_Header_QA_divQuickLink");
    divQuickLinkID.style.left="60px";    
   
           
}

function onSignInLoadTimeout(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    DivLoader.style.display = "block" ; 
    var spanMsg=document.getElementById("lnkppngLogin");
    spanMsg.innerHTML= "Invalid user details";
}

function onSignInFailure(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    var spanMsg=document.getElementById("lnkppngLogin");
    DivLoader.style.display = "block" ; 
    spanMsg.innerHTML= "Invalid user details";
    
}

function clickButton(e, buttonid)
{ 
      var bt = document.getElementById(buttonid);       
      if (typeof bt == 'object')
      { 
            if(navigator.appName.indexOf("Netscape")>(-1))
            { 
                  if (e.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 
                  if (event.keyCode == 13)
                  { 
                        bt.click(); 
                        return false; 
                  } 
            }
        }      
} 
function validateForgetPassword()
{
    if (document.getElementById('ctl00_signUp_txtUserid').value =="")
    {
            document.getElementById('ctl00_signUp_txtUserid')
            Jalert("Enter email id") ;
            document.getElementById('ctl00_signUp_txtUserid').focus();
        return ;
    }
     var m=/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i;
    if (!m.test(document.getElementById('ctl00_signUp_txtUserid').value))
   {
        Jalert("Invalid E-mail address! Please re-enter.");
        document.getElementById('ctl00_signUp_txtUserid').focus();
        return false;
   } 

     var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "none" ; 

   var DivLoader =  document.getElementById("divFpwdLdr");
     DivLoader.style.display = "block" ; 
        
   signup.gfnForgotPwd( document.getElementById('ctl00_signUp_txtUserid').value, onfpwdSuccess, onfpwdLoadTimeout, onfpwdFailure);         
   
}

function onfpwdSuccess(result, eventArgs)
{
    var spnlblCnfrm =  document.getElementById("lblCnfrm") ;
    var DivCnfrm =  document.getElementById("cnfrm") ;
    var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "none" ;
    DivCnfrm.style.display = "block" ;
    spnlblCnfrm.innerHTML = result ;
    var DivLoader =  document.getElementById("divFpwdLdr");
    DivLoader.style.display = "none" ; 
    //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    //{ 
        document.getElementById('FlexGallery').style.visibility="hidden";
        document.getElementById('flexCus').style.visibility="hidden";
        document.getElementById('mainDivFlex').style.visibility="hidden";
     //} 
}

function disFpwd()
{
    document.getElementById('ctl00_SignUp_txtUserid').value = "";
    var DivCnfrm =  document.getElementById("cnfrm") ;
    var DividCon =  document.getElementById("idCon") ;
    DividCon.style.display = "block" ;
    DivCnfrm.style.display = "none" ;
    document.getElementById('ctl00_SignUp_cmdSUCancel').click() ;
    
}

function onfpwdLoadTimeout(result) {

}

function onfpwdFailure(result)  {

}

/*this is for RHS signIn module  */
function validationRHSSignIn()
{
    
    if(!txtEmpty('ctl00_cph_rhsjoin_txtEmail') || document.getElementById('ctl00_cph_rhsjoin_txtEmail').value == 'Enter email id')
    {        
        Jalert("Enter your email id");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        return false;
    }
    if(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value.length >40)
    {
        Jalert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        return false;
    }
    else
    {    
   
         if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value))
        {
            Jalert("Invalid E-mail Address! Please re-enter.");
            document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
            return false;
        }
    }
    
    if(document.getElementById('ctl00_cph_rhsjoin_txtPassword').value.length < 1 || document.getElementById('ctl00_cph_rhsjoin_txtPassword').value == 'Enter password')
    {
        Jalert("Enter password");
        document.getElementById('ctl00_cph_rhsjoin_txtPassword').focus();        
        return false;   
    }
     signup.gfnSignIn(document.getElementById('ctl00_cph_rhsjoin_txtEmail').value,document.getElementById('ctl00_cph_rhsjoin_txtPassword').value, onRHSSignINSuccess, onRHSSignInLoadTimeout,onRHSSignInFailure);  
     return false;
}

function onRHSSignINSuccess(result, eventArgs)
{
    if (result=="-1")
    {
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "block" ; 
        var spanMsg=document.getElementById("lnkppngLogin");
        spanMsg.innerHTML= "Invalid user details";  
        Jalert("Invalid user details");
        document.getElementById('ctl00_cph_rhsjoin_txtEmail').focus();
        //document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "none";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "block";
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="hidden";
            document.getElementById('flexCus').style.visibility="hidden";
            document.getElementById('mainDivFlex').style.visibility="hidden";
        //} 
    }
    else
    {
        $find('modpopSignUp').hide();
        var DivLoader =  document.getElementById("divppngLogin");
        DivLoader.style.display = "none" ; 
         var DivSignUpWell =  document.getElementById("divWizardStep2a");
         DivSignUpWell.style.display = "block";   
        document.getElementById("divAccOpt").innerHTML = " <a id='lnkSignout' runat='server' href='/signout.aspx' style='border-style: none;'><img src='/images/HImages/ppng-signOut.gif' alt='Sign out' /></a>";
       // document.getElementById("ctl00_cph_rhsjoin_divRHSCloud").style.display = "block";
        //document.getElementById("ctl00_cph_rhsjoin_divRHSSignin").style.display = "none";
         //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        //{ 
            document.getElementById('FlexGallery').style.visibility="visible";
            document.getElementById('flexCus').style.visibility="visible";
            document.getElementById('mainDivFlex').style.visibility="visible";
        //} 
    }
}
function onRHSSignInLoadTimeout(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    DivLoader.style.display = "block" ; 
    var spanMsg=document.getElementById("lnkppngLogin");
    spanMsg.innerHTML= "Invalid user details";
}

function onRHSSignInFailure(result)
{
    var DivLoader =  document.getElementById("divppngLogin");
    var spanMsg=document.getElementById("lnkppngLogin");
    DivLoader.style.display = "block" ; 
    spanMsg.innerHTML= "Invalid user details";
    
}
// JScript File

var headAlrt="PPG Alert :\n\n" ;
var headcnfrm ="PPG Confirm :\n\n" ; 
			
function Jalert(Msg)
{
    alert(headAlrt + Msg);
}
function Jconfirm(Msg)
{
    return confirm(headcnfrm + Msg);
}
 String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
 function txtEmpty(ctlID)
 {                       
    var TemCtl = document.getElementById(ctlID) ;                   
    if (TemCtl.value.trim() == "")
    return false;
    else
    return true;
 }
function SectorValidation(ctlID)
{
    var TemCtl = document.getElementById(ctlID).value ;                   
    if (TemCtl.value.trim() == "please select sector")
    return false;
    else
    return true;
}
function SubSectorValidation(ctlID)
{
    var TemCtl = document.getElementById(ctlID) ;                   
    if (TemCtl.value.trim() == "Please select a subsector")
    return false;
    else
    return true;
}
function txtChkPass(ctlID,ctlId2)
{                       
    var TemCtl = document.getElementById(ctlID) ;  
    var tempct2= document.getElementById(ctlId2) ;                  
    if (TemCtl.value.trim() != tempct2.value.trim())
    return false;
    else
    return true;
}
function checkCheckBoxes(ctlId1)
{
    var TemCtl=document.getElementById(ctlId1);                   
    if (TemCtl.checked == false)
        {
            return false;
        }
        else
        {
            return true;
        }    
}

//codeblock from bannerblurb.ascx
 var Tot_Txt = 0 ,  Column_Cnt = 0 ,intervalle=10000;var numbre_total_txt;

            var ColCnt ;

            var txt = new Array();

            var col = new Array();

            

            function boucle_images1()

            {

                  txt[0]='World class online photo printing,\<br \> gifting and sharing';
                  txt[1]='Have fun while preserving\<br \> your photo memories';
                  txt[2]='Upload, Share, Print, Albums,\<br \> Slideshows, Mobile features and more';
                  txt[3]='Hang on and we promise you\<br \> loads of wonderful experiences…..';
                  txt[4]='Calling all Digital camera owners, \<br \> Mobile camera owners';
                  txt[5]='Wedding album makers, \<br \> creative designers and card makers';   
                  //txt[6]='Photo enthusiasts who likes to\<br \> upload their photos\<br \> to a central secure server (anytime, anywhere access)';
                  txt[6]='Organize, edit, share prints of multiple sizes, textures and formats\<br \> ';
                  txt[7]='Photographers and photo enthusiasts, \<br \> mini color lab owners';
                  txt[8]='Photo art creators, Small and \<br \> large format photo finishers';
                  txt[9]='Spread the joy of sharing fond memories and cherished moments of life';
                  txt[10]='Import photos from Flickr & Picasa \<br \> Win exciting awards at Photo Contest';
                  
                  col[0]='BBB';
                          

                  numbre_total_txt = 10 ;
                  ColCnt = 1 ;
                  txtrotate();
            }
            

            function txtrotate()
            {
                  Tot_Txt = rnd(numbre_total_txt);
                  Column_Cnt = rnd(ColCnt);
                  if(Tot_Txt == numbre_total_txt)
                  Tot_Txt=0 ;
                  if(Column_Cnt == ColCnt)
                  Column_Cnt = 0 ;
                  document.getElementById('dvBB').innerHTML =  txt[Tot_Txt];
                  document.getElementById('dvBB').className = col[Column_Cnt];
                  setTimeout('txtrotate()',intervalle) ;
            }
            boucle_images1();
            
            function rnd(max)
            { 
                 var rndnum = max * Math.random() ;
                  rndnum = Math.ceil (rndnum) ;
                  return rndnum ;
            }
            
            function mfnPPNGBannerFlashCheck()
            {
            // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
                    var hasProductInstall = DetectFlashVer(6, 0, 65);

                    // Version check based upon the values defined in globals
                    var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

                    // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
                    if ( hasProductInstall && !hasRequestedVersion ) {
	                    // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	                    // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	                    // DO NOT MODIFY THE FOLLOWING FOUR LINES
	                    // Location visited after installation is complete if installation is required
	                    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	                    var MMredirectURL = window.location;
                        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                        var MMdoctitle = document.title;
                    } else if (hasRequestedVersion) {
	                    // if we've detected an acceptable version
	                    // embed the Flash Content SWF when all tests are passed
			                     window["PPNG_banner"] = new Object();
                                               var so = new SWFObject("PPNG_banner.swf", "PPNG_banner", "922", "270", "6" ,"#ffffff");
                                               so.addParam("scale", "noscale");
                                               so.write("flashBan");
                    	
                      }
            }
            
            function mfnPPNGCustomizerFlashCheck()
            {
            // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
                    var hasProductInstall = DetectFlashVer(6, 0, 65);

                    // Version check based upon the values defined in globals
                    var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

                    // Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
                    if ( hasProductInstall && !hasRequestedVersion ) {
	                    // MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
	                    // This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
	                    // DO NOT MODIFY THE FOLLOWING FOUR LINES
	                    // Location visited after installation is complete if installation is required
	                    var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	                    var MMredirectURL = window.location;
                        document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                        var MMdoctitle = document.title;
                    } else if (hasRequestedVersion) {
	                    // if we've detected an acceptable version
	                    // embed the Flash Content SWF when all tests are passed
			                     window["ppngCustomizer"] = new Object();
                                               var so = new SWFObject("swf/ppngCustomizer.swf", "ppngCustomizer", "930", "265", "6" ,"#ffffff");
                                               so.addParam("scale", "noscale");
                                               so.write("flex");
                    	
                      }
            }
//email check start

function basicCheck(emails)
{
    var skip=false;
     for(i=0;i<emails.length;i++)
      {
                    if(emails[i].indexOf(" ")==0)
                    {
                        emails[i] = emails[i].substring(1);
                        return false;
                    }
                    if(emails[i].indexOf(",")!=-1)
                    {
                        alert("Please separate multiple addresses with a ; (semicolon)");
                        skip=true;
                        break;
    
                    }
                    if(!CheckEmail(emails[i]))
                    {
                        skip=true;
                        break;
                    }
                    
      }
      if(!skip)
      {
        return true;
      }
      else
      {
        return false;
      }
}

function CheckEmail(email) 
{

    if (email == "") 
    {
        Jalert("Please enter email ID");
        return false;
    }

    if (email.indexOf(" ") != -1) 
    {
        Jalert("No spaces are allowed");
        return false;
    }

    if (email.indexOf("@") == -1) 
    {
         Jalert("Email ID should have @");
         return false;
    }

    if (email.indexOf("@") < 1) 
    {
        Jalert("An email id is invalid");
        return false;
    }

    if (email.indexOf("@") != email.lastIndexOf("@")) 
    {
        Jalert("An email address must contain one @");
        return false;
    }

    if (email.indexOf(".") == -1) 
    {
        Jalert("Email ID should have . (dot)");
        return false;
    }

    if (email.indexOf(".") >= (email.length-2)) 
    {
        Jalert("Email ID is invalid");
        return false;
    }

    if ((email.indexOf("@") - email.lastIndexOf(".")) > 0) 
    {
       Jalert("An email id is invalid");
       return false;
    }

    return true;
}

function trim(inputString) {

   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
   Jalert(retValue);
} 

//email check function ends
function TAFSub()
{                 
    if(!txtEmpty('ctl00_Header_QA_TAF_txtNm'))
    {        
        Jalert("Enter name");
        document.getElementById('ctl00_Header_QA_TAF_txtNm').focus();
        return false;
        
    }  

    var emails=document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value.split(';');    
    if(!basicCheck(emails))
    {
       // Jalert("Email Invalid or empty");
        document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').focus();
        return false;
    }
    var friendEmails=document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value.split(';');
    var friendEmails1=trim(friendEmails);    
    if(!basicCheck(friendEmails))
    {
        Jalert("Friend Email Invalid or empty");
        document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').focus();
        return false;
    }
    
    //mobile number
    if(!txtEmpty('ctl00_Header_QA_TAF_txtMobNm'))
    {
       // Jalert("Mobile Number Empty");
        document.getElementById('ctl00_Header_QA_TAF_txtMobNm').focus();
        Jalert("Enter valid phone number");
        return false;
    }
    
    var mobNumbers=document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value.split(';');
    if(!checkMobNum(mobNumbers))
    { 
        document.getElementById('ctl00_Header_QA_TAF_txtMobNm').focus();  
        return false;
    }
    if(!txtEmpty('ctl00_Header_QA_TAF_txtYourMsg'))
    {
        document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').focus();
        Jalert("Enter your message");
        return false;
    }    
     if(!txtEmpty('ctl00_Header_QA_TAF_txtCode'))
    {
        document.getElementById('ctl00_Header_QA_TAF_txtCode').focus();
        Jalert("Enter text below");
        return false;
    }    
    if(document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value.length > 250)
    {
        Jalert("Maximum 250 characters only");
        document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').focus();
        return false;
    }
     document.getElementById('TAFRecLdr').style.display = "block";     
     document.getElementById('divFailure').style.display = "none";    
     tellafriend.instaf(document.getElementById('ctl00_Header_QA_TAF_txtNm').value,document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value,document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value,document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value,document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value,document.getElementById("ctl00_Header_QA_TAF_txtCode").value, onInsTAFSuccess,onInsTAFTimeout,onInsTAFFailure);     
     //document.getElementById('RecLdr').style.display = "none";
    return false;     
 }
 function TAFClear()
 {
    document.getElementById('ctl00_Header_QA_TAF_txtNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value = "";
    document.getElementById("ctl00_Header_QA_TAF_txtCode").value = "";
 }
 function onInsTAFSuccess(result, eventArgs)
{
    //document.getElementById('result').style.display = "block";            
    if (result =="1")
    {
        document.getElementById('divSuccess').style.display = "block";        
        document.getElementById('TAFRecLdr').style.display = "none";
        document.getElementById("divTAFInvalidSecret").style.display = "none";        
        document.getElementById('TAFRecLdr').style.display = "none";
        //document.getElementById('imgJobberVoiceBoxWellLoader').style.display = "none";
        if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
        { 
            document.getElementById('FlexGallery').style.display="block";
            document.getElementById('flexCus').style.display="block";
        } 
        document.getElementById('mainDivFlex').style.visibility="hidden";
        TAFClear();
     }     
     if (result=="-2")
     {
            document.getElementById('divFailure').style.display = "none";
            document.getElementById('divSuccess').style.display = "none";
            document.getElementById('TAFRecLdr').style.display = "none";
            document.getElementById("divTAFInvalidSecret").style.display = "block"; 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
            { 
                document.getElementById('FlexGallery').style.display="none";
                document.getElementById('flexCus').style.display="none";
            } 
             document.getElementById('mainDivFlex').style.visibility="visible";

     }
     
     return false;
}  
function ShowTafclose(mode)
{
    if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     { 
         document.getElementById('FlexGallery').style.display="block";
         document.getElementById('flexCus').style.display="block";
      } 
                  document.getElementById('mainDivFlex').style.visibility="visible";

      return false;
}
function ShowTafModalpopup(mode)
{
   //$find('ctl00_Footer_mpTAF').show(); ctl00_Header_QA_mpTAF 
    document.getElementById('ctl00_Header_QA_TAF_txtNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourEMailID').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtFrdEmail').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtMobNm').value = "";
    document.getElementById('ctl00_Header_QA_TAF_txtYourMsg').value = "";
    document.getElementById("ctl00_Header_QA_TAF_txtCode").value = "";
   $find('ctl00_Header_QA_mpTAF').show();
   document.getElementById('ctl00_Header_QA_TAF_txtNm').focus();
   //if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
     //{ 
         //document.getElementById('FlexGallery').style.display="none";
         //document.getElementById('flexCus').style.display="none";
      //} 
      document.getElementById('FlexGallery').style.visibility="hidden";
         document.getElementById('flexCus').style.visibility="hidden";
                     document.getElementById('mainDivFlex').style.visibility="hidden";

}
function TAFhide()
{ 
    document.getElementById('FlexGallery').style.visibility="visible";
    document.getElementById('flexCus').style.visibility="visible";
                document.getElementById('mainDivFlex').style.visibility="visible";

    document.getElementById('divSuccess').style.display = "none";
    return false;
}

function ShowTafclose()
{
  document.getElementById('FlexGallery').style.visibility="visible";
    document.getElementById('flexCus').style.visibility="visible";
                document.getElementById('mainDivFlex').style.visibility="visible";

    document.getElementById('divSuccess').style.display = "none";
    return false;
}

function onInsTAFTimeout(result) {
}

function onInsTAFFailure(result)  {
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function checkMobNum(mobNumbers)
{
        if(mobNumbers.length == 0)
        {
                 Jalert("Please Enter Mobile Number");
                 return false;
        }
        if(mobNumbers.length>10)
        {
                 Jalert("Please Enter a Valid Mobile Number");
                 return false;
        }
        else if(mobNumbers.indexOf(",")!=-1)
        {
                 Jalert("Please seperate mobile numbers with a ; (semicolon)");
                 return false;

        }
        else if(mobNumbers.indexOf(" ")!=-1)
        {
                 Jalert("Please seperate mobile numbers with a ; (semicolon)");
                 return false;
        }
        else
        {
                
                for(i=0;i<mobNumbers.length;i++)
                {
                        res = checkInternationalPhone(mobNumbers[i]);
                        if(res == false)
                        {
                                Jalert("Please enter valid mobile number");
                                return false;
                         }
                }
        }
        return true;
}
function checkInternationalPhone(strPhone)
{
    var digits = "0123456789";
    var validWorldPhoneChars = "+";
    var minDigitsInIPhoneNumber = 10;
    s=stripCharsInBag(strPhone,validWorldPhoneChars);
    return (isInteger(s) && s.length == minDigitsInIPhoneNumber);
}

function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function switchHeaderClass(obj,obj2)
{
var el=document.getElementById(obj);
if(el!=null)
{
if(el.className.indexOf("item-collapse")>-1)
{
el.className=el.className.replace("item-collapse","item");}
else
{
el.className=el.className.replace("faq-item","faq-item-collapse");}}
el=document.getElementById(obj2);
if(el!=null)
{
if(el.className.indexOf("headline-collapse")>-1)
{
el.className=el.className.replace("headline-collapse","headline");}
else
{
el.className=el.className.replace("faq-headline","faq-headline-collapse");}}}