var ECLIPSE_FRAME_NAME = "ContentViewFrame";
var eclipseBuild = false;
var liveDocsBaseUrl = "http://livedocs.adobe.com/flex/3";
var liveDocsBookName = "langref";

var terms_HELPCFG = "PlatformASLR.helpcfg";
//splitter
var splitterActiveFlag = false ;
var splitterObj = false;
var MIN_LEFT = 60;
var MIN_RIGHT = 200;
var use_robohelp_behavior = false;
var agt=navigator.userAgent.toLowerCase();

//Start: Bug#1325173
function alternate(id){
 	 
 if(document.getElementsByTagName){  
   var table = document.getElementById(id);  
   var rows = table.getElementsByTagName("tr");
   var r1 = rows.length-1;  
    
    var scheme = "odd";
    var k = 0*1;
    
   for(i = 1; i < rows.length; i++){ 
           
 //manipulate rows
 
 if(scheme=="odd"){
       if((k*1)<(i*1) && i < rows.length - 3){
       rows[i].className = "even";
       k=1*i;
       if((i+1)<=rows.length && i < rows.length - 3){
       	   k=1*(i+1);
       	rows[k].className = "even";
       	scheme="even";
       }
       
       }
  }else{
  	  if((k*1)<(i*1) && i < rows.length - 3){
  	  rows[i].className = "odd";
  	  k=1*i;
  	  if(i!=1&&(i+1)<=rows.length && i < rows.length - 3){
  	  	  k=1*(i+1);
       	rows[k].className = "odd";
       	scheme="odd";
      }
      
      }
  }
 
 }
 }
}
//End: Bug#1325173

//Start: Bug#2347121
function ionReadyLoad(label,loc){
		var badge = new ionBadge();
		badge.url = window.location.toString();
		badge.locale = +loc;
		badge.container = document.getElementById("badgeContainer");
		badge.anchor = document.getElementById("badgeAnchor");
		badge.siteArea = "devcenter";
		badge.productLabel = +label;
		badge.commenting = true;
		badge.rating = true;
		badge.ratingType = "thumbs";
		badge.system = "adc";
		badge.timeOutDelay = 10000;
		badge.maxCommentLength = 100;
		
		badge.load();
	}
//End: Bug#2347121

//Start: Bug#1899661
function noFrms(){ 
        var doc = parent.frames["classFrame"].location.href.substring(window.location.href.lastIndexOf("/")+1); 
        if(doc=="search.html"){ 
          var curLoc=window.top.location.href.split("?"); 
          var openFile; 
          if(curLoc[1]!=null){ 
            curLoc = curLoc[1].split("#"); 
            var search = curLoc[1];
            curLoc = curLoc[0].split("&amp;");       
            openFile = window.top.location.href.substring(0,window.top.location.href.lastIndexOf("?")+1); 
            openFile = openFile.substring(0,openFile.lastIndexOf("/")+1)+"search.html#"+search;
          }
          else{ 
            curLoc[0]="index.html"; 
            openFile = window.top.location.href.substring(0,window.top.location.href.lastIndexOf("/")+1)+curLoc[0];
          } 
          top.location=openFile; 
        }else{
          top.location=top.classFrame.location;
        }
      } 

function searchfunctionsubmit(baseref){
       var searchStr=document.getElementById('search-livedocs').value;
       window.location=baseRef+"search.html"+"###"+searchStr;
        }

function submitStandAloneSearchValue(){
	var searchStr=document.getElementById('search-livedocs').value;
          loadClassFrame("search.html?search=" +searchStr);
          document.getElementById('subTitle').childNodes.item(0).data = "Search Results";
          return false; 
}

function submitValue(title,url,label,site) {
var title=title;
var searchStr=document.getElementById('search-livedocs').value;
title = encodeURIComponent(encodeURIComponent(title));
	  var ptn = /\./;
	  if (ptn.test(title)) {
	  	title = title.replace(ptn, "%252E"); 
	  }  
        if(document.getElementById('checkBoxId').checked){
        top.location.href="http://"+url+"?q=" + searchStr
+"&loc=en_US"
+"&hl=en_US"
+"&lbl="+label
+"&go=Search"
+"&self=1"
+"&site="+site;
} 
        else{ 
top.location.href="http://"+url+"?q=" + searchStr
+"&loc=en_US"
+"&hl=en_US"
+"&lbl="+label
+"&go=Search"
+"&self=1";
} 
          document.getElementById('subTitle').childNodes.item(0).data = "";
          return false; 
}

function addIonComments(label)
{
	var loc = getLangName();
	function getLangName() {		
	var lang = "en-us";		
	var metaElements = document.all ?
	document.all.tags('meta') :
	document.getElementsByTagName ?
	document.getElementsByTagName ('meta') : new Array();

	var metaLangVals = new Array();
	var i = 0;

	for (var m = 0; m < metaElements.length; m++) {	    
	if (metaElements[m].name == "lang") {	      
	lang = metaElements[m].content;	      
	break;	    
	}		
	}		

	var ptn = /(..)-(..)/;		

	if (ptn.test(lang)) {			
	var countryCode = lang.replace(ptn, "$1");			
	var languageCode = lang.replace(ptn, "$2");			
	lang = countryCode + "_" + languageCode.toUpperCase();		

	}	  
	return lang;	
	}		

	var commentsContainer = "ionComHere";	

	ionComAddLoadEvent(function() {		
	var thisURL = encodeURIComponent(window.location);		
	var resource = thisURL.replace(new RegExp(/%23(.*)/),"");		
	ionComments.setup(resource, loc, commentsContainer, { siteArea: 'help', productLabel: +label });	})	
}

function gotoHome(linkURL) 
{
	var windowURL= window.location.href;

	var value = windowURL.replace(/title-bar\.html.*/,linkURL );

 	if (value != null) { 
		parent.top.location = value;
	}
}

function findObject(objId) {

    if (document.getElementById)
        return document.getElementById(objId);

    if (document.all)
        return document.all[objId];
}

function isEclipse() {
    return eclipseBuild
}

		
function configPage() {

	var d=document.location.href.toString();
	parameter_index = d.lastIndexOf('?');
    var args = '';
	if (parameter_index != -1) {
		args=d.substring(parameter_index+1,d.length);
	}
	//Start: Bug#1882766 
	if (args.indexOf('#') != -1){
		args = args.replace(new RegExp(/#/),"%23");
	}
	else if (args.indexOf('%23') != -1){
		args = args.replace(new RegExp(/%23/),"#");
	}
	
    setRowColorsInitial(true, "Property");
    setRowColorsInitial(true, "Method");
    setRowColorsInitial(true, "ProtectedMethod");   
    setRowColorsInitial(true, "Event");
    setRowColorsInitial(true, "Style");
    setRowColorsInitial(true, "SkinPart");
    setRowColorsInitial(true, "SkinState");
    setRowColorsInitial(true, "Constant");

    if (isEclipse()) {
        if (window.name != "classFrame")
        {
            var localRef = window.location.href.indexOf('?') != -1 ? window.location.href.substring(0, window.location.href.indexOf('?')) : window.location.href;

	    var rootdir = "doc/";
            localRef = localRef.substring(localRef.indexOf(rootdir) + rootdir.length);

            if (window.location.search != "")
                localRef += ("#" + window.location.search.substring(1));

            window.location.replace(baseRef + "frames.html?" + localRef);
            return;
        }
        else
        {
		setStyle(".eclipseBody", "display", "block");
            if (window.location.hash != "")
                window.location.hash=window.location.hash.substring(1);
        }
    }
    //if we want it showing, then we need to cause it to open
    restoreSplitterPos();
    if (getCookie("asdocs_view") == "showtoc")
	     showHideTOC(true);
	else
		showHideTOC(false);
	     
	     

    try{
	    getFilterContent(filter_file,args);
    }catch(e)
    {
    }
    
    //have to wait till dom loads
    if (agt.indexOf("adobe help viewer 2") != -1 || agt.indexOf("community help client") != -1) {
    use_robohelp_behavior = true;
    document.getElementById("gsa").style.display = "none";
}

}

function loadFrames(classFrameURL, classListFrameURL) {
    var classListFrame = findObject("classListFrame");
    if(classListFrame != null && classListFrameContent!='')
        classListFrame.document.location.href=classListFrameContent;

    if (isEclipse()) {
        var contentViewFrame = findObject(ECLIPSE_FRAME_NAME);
        if (contentViewFrame != null && classFrameURL != '')
            contentViewFrame.document.location.href=classFrameURL;
    }
    else {
        var classFrame = findObject("classFrame");
        if(classFrame != null && classFrameContent!='')
            classFrame.document.location.href=classFrameContent;
    }
}

function showTitle(title) {
    if (!isEclipse())
        top.document.title = title;
}

function loadClassFrame(classFrameURL) {
    if (parent.frames["classFrame"] != null) {
        parent.frames["classFrame"].location = classFrameURL;
    }
    else if (parent.frames["packageFrame"] != null) {
        if (parent.frames["packageFrame"].frames["classFrame"] != null) {
            parent.frames["packageFrame"].frames["classFrame"].location = classFrameURL;
        }
    }
}

function loadClassListFrame(classListFrameURL) {
    if (parent.frames["classListFrame"] != null) {
        parent.frames["classListFrame"].location = classListFrameURL;
    }
    else if (parent.frames["packageFrame"] != null) {
        if (parent.frames["packageFrame"].frames["classListFrame"] != null) {
            parent.frames["packageFrame"].frames["classListFrame"].location = classListFrameURL;
        }
    }
}

function loadPage(relativeURLFromBase) {
     document.location.href = baseRef+relativeURLFromBase;
}

function gotoLiveDocs(primaryURL, secondaryURL, locale) {
        if (locale == "en-us" || locale == "en_us" || locale == "en_US") {
             locale = "";
        } 
        else {
              locale = "_" + locale.substring(3);
        }
    var url = liveDocsBaseUrl + locale + "/" + liveDocsBookName + "/frames.html?" + primaryURL;
    if (secondaryURL != null && secondaryURL != "")
        url += ("&" + secondaryURL);

    window.open(url, "mm_livedocs", "menubar=1,toolbar=1,status=1,scrollbars=1,resizable=yes");
}

function findTitleTableObject(id)
{
    if (isEclipse())
        return parent.titlebar.document.getElementById(id);
    else if (top.titlebar)
        return top.titlebar.document.getElementById(id);
    else
        return document.getElementById(id);
}

function titleBar_setSubTitle(title)
{
    if (isEclipse() || top.titlebar)
        findTitleTableObject("subTitle").childNodes.item(0).data = title;
}

function titleBar_setSubNav(showConstants,showProperties,showStyles,showSkinPart,showSkinState,showEffects,showEvents,showConstructor,showMethods,showExamples,
                showPackageConstants,showPackageProperties,showPackageFunctions,showInterfaces,showClasses,showPackageUse)
{
	findTitleTableObject("propertiesLink").style.display = showProperties ? "inline" : "none";
	findTitleTableObject("propertiesBar").style.display = (showProperties && (showPackageProperties || showConstructor || showMethods || showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("packagePropertiesLink").style.display = showPackageProperties ? "inline" : "none";
	findTitleTableObject("packagePropertiesBar").style.display = (showPackageProperties && (showConstructor || showMethods || showPackageFunctions || showEvents || showStyles || showConstants || showEffects || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("constructorLink").style.display = showConstructor ? "inline" : "none";
	findTitleTableObject("constructorBar").style.display = (showConstructor && (showMethods || showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("methodsLink").style.display = showMethods ? "inline" : "none";
	findTitleTableObject("methodsBar").style.display = (showMethods && (showPackageFunctions || showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("packageFunctionsLink").style.display = showPackageFunctions ? "inline" : "none";
	findTitleTableObject("packageFunctionsBar").style.display = (showPackageFunctions && (showEvents || showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("eventsLink").style.display = showEvents ? "inline" : "none";
	findTitleTableObject("eventsBar").style.display = (showEvents && (showStyles || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("stylesLink").style.display = showStyles ? "inline" : "none";
	findTitleTableObject("stylesBar").style.display = (showStyles && (showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("SkinPartLink").style.display = showSkinPart ? "inline" : "none";
	findTitleTableObject("SkinPartBar").style.display = (showSkinPart && (showSkinState || showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("SkinStateLink").style.display = showSkinState ? "inline" : "none";
	findTitleTableObject("SkinStateBar").style.display = (showSkinState && (showEffects || showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("effectsLink").style.display = showEffects ? "inline" : "none";
	findTitleTableObject("effectsBar").style.display = (showEffects && (showConstants || showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("constantsLink").style.display = showConstants ? "inline" : "none";
	findTitleTableObject("constantsBar").style.display = (showConstants && (showPackageConstants || showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("packageConstantsLink").style.display = showPackageConstants ? "inline" : "none";
	findTitleTableObject("packageConstantsBar").style.display = (showPackageConstants && (showInterfaces || showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("interfacesLink").style.display = showInterfaces ? "inline" : "none";
	findTitleTableObject("interfacesBar").style.display = (showInterfaces && (showClasses || showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("classesLink").style.display = showClasses ? "inline" : "none";
	findTitleTableObject("classesBar").style.display = (showClasses && (showPackageUse || showExamples)) ? "inline" : "none";
	findTitleTableObject("packageUseLink").style.display = showPackageUse ? "inline" : "none";
	findTitleTableObject("packageUseBar").style.display = (showPackageUse && showExamples) ? "inline" : "none";
	findTitleTableObject("examplesLink").style.display = showExamples ? "inline" : "none";
}

function titleBar_gotoClassFrameAnchor(anchor)
{
    if (isEclipse())
        parent.classFrame.location = parent.classFrame.location.toString().split('#')[0] + "#" + anchor;
    else
        location = location.toString().split('#')[0] + "#" + anchor;
}

function setMXMLOnly() 
{
    if (getCookie("showMXML") == "false")
    {
        toggleMXMLOnly();
    }
}

function toggleMXMLOnly() 
{
    var mxmlDiv = findObject("mxmlSyntax");
    var mxmlShowLink = findObject("showMxmlLink");
    var mxmlHideLink = findObject("hideMxmlLink");
    if (mxmlDiv && mxmlShowLink && mxmlHideLink)
    {
        if (mxmlDiv.style.display == "none")
        {
            mxmlDiv.style.display = "block";
            mxmlShowLink.style.display = "none";
            mxmlHideLink.style.display = "inline";
            setCookie("showMXML","true", new Date(3000,1,1,1,1), "/", document.location.domain);
        }
        else
        {
            mxmlDiv.style.display = "none";
            mxmlShowLink.style.display = "inline";
            mxmlHideLink.style.display = "none";
            setCookie("showMXML","false", new Date(3000,1,1,1,1), "/", document.location.domain);
        }
    }
}

function showHideInherited()
{   
    setInheritedVisible(getCookie("showInheritedConstant") == "true", "Constant");
    setInheritedVisible(getCookie("showInheritedProtectedConstant") == "true", "ProtectedConstant");
    setInheritedVisible(getCookie("showInheritedProperty") == "true", "Property");
    setInheritedVisible(getCookie("showInheritedProtectedProperty") == "true", "ProtectedProperty");
    setInheritedVisible(getCookie("showInheritedMethod") == "true", "Method");
    setInheritedVisible(getCookie("showInheritedProtectedMethod") == "true", "ProtectedMethod");
    setInheritedVisible(getCookie("showInheritedEvent") == "true", "Event");
    setInheritedVisible(getCookie("showInheritedcommonStyle") == "true", "commonStyle");
	setInheritedVisible(getCookie("showInheritedsparkStyle") == "true", "sparkStyle");
	setInheritedVisible(getCookie("showInheritedhaloStyle") == "true", "haloStyle");
    setInheritedVisible(getCookie("showInheritedSkinPart") == "true", "SkinPart");
    setInheritedVisible(getCookie("showInheritedSkinState") == "true", "SkinState");
    setInheritedVisible(getCookie("showInheritedEffect") == "true", "Effect");
}


function setInheritedVisible(show, selectorText)
{
    if (document.styleSheets[0].cssRules != undefined)
    {
        var rules = document.styleSheets[0].cssRules;
        for (var i = 0; i < rules.length; i++)
        {
            if (rules[i].selectorText == ".hideInherited" + selectorText)
                rules[i].style.display = show ? "" : "none";
               
            if (rules[i].selectorText == ".showInherited" + selectorText)
                rules[i].style.display = show ? "none" : "";
        }
    }
    else
    {
        document.styleSheets[0].addRule(".hideInherited" + selectorText, show ? "display:inline" : "display:none");
        document.styleSheets[0].addRule(".showInherited" + selectorText, show ? "display:none" : "display:inline");
    }

    setCookie("showInherited" + selectorText, show ? "true" : "false", new Date(3000,1,1,1,1), "/", document.location.domain);
    setRowColors(show, selectorText);
}

function setRowColors(show, selectorText)
{
    var rowColor = "#F2F2F2";
    var table = findObject("summaryTable" + selectorText);

    if (table != null)
    {
        var rowNum = 0;
        for (var i = 1; i < table.rows.length; i++)
        {
            if (table.rows[i].className.indexOf("hideInherited") == -1 || show)
            {
                rowNum++;
                table.rows[i].bgColor = (rowNum % 2 == 0) ? rowColor : "#FFFFFF";
            }           
        }
    }
}

function setRowColorsInitial(show, selectorText)
{
    var rowColor = "#F2F2F2";
    var table = findObject("summaryTable" + selectorText);

    if (table != null)
    {
        var rowNum = 0;

        for (var i = 1; i < table.rows.length; i++)
        {
            if (table.rows[i].className.indexOf("hideInherited") == -1 && show)
            {
                rowNum++;
                table.rows[i].bgColor = (rowNum % 2 == 0) ? rowColor : "#FFFFFF";
            }           
        }
    }
}

function setStyle(selectorText, styleName, newValue)
{
    if (document.styleSheets[0].cssRules != undefined)
    {
        var rules = document.styleSheets[0].cssRules;

        for (var i = 0; i < rules.length; i++)
        {
            if (rules[i].selectorText == selectorText)
            {
                rules[i].style[styleName] = newValue;
               break;
            }
        }
    }

    else
    {
        document.styleSheets[0].addRule(selectorText, styleName + ":" + newValue);
    }
}

  function setView(view){
        var expire = new Date();
        expire.setDate(expire.getDate()+90); // Cookie expires after 90 days
 	var pathDomainString="path=;";
	if(navigator.userAgent.indexOf("Firefox")!=-1)
	{
	// code for possible use with FF when it gets working
		var theHost=document.location.hostname;
		pathDomainString = "path=/;domain="+theHost+";";		
	}

        document.cookie = "asdocs_view=" + view + ";"+ pathDomainString+"expires=" + expire.toGMTString();
    }   
    
var packagesLoaded = false, classesLoaded = false;
function loadPackagesList(page_request){
	document.getElementById("packagelist").innerHTML=page_request.responseText;
	packagesLoaded = true;  
	try{
	    if(classesLoaded) 
		    doFilterStateChange1();
	    }catch(e)
	    {
	    }
	setTimeout("restorePackageListScrollTop()", 1000);
}

function loadClassesList(page_request){
	document.getElementById("classlist").innerHTML=page_request.responseText;
	classesLoaded = true;    
	try{
	    if(packagesLoaded) 
		    doFilterStateChange1();
	    }catch(e)
	    {
	    }
	setTimeout("restoreClassListScrollTop()", 1000);
}


function init()
{
	if(buildType!='jslr')
		ajaxGet(baseRef + "package-list.html", loadPackagesList);
	if (baseRef=='' || baseRef=='./' || buildType=='jslr') {
		ajaxGet(baseRef+"all-classes.html", loadClassesList);
	} else {
		ajaxGet("class-list.html", loadClassesList);
	}
	configPage();
	scrollToNameAnchor();
}

/* needed for IPH builds used offline in CHC */
function scrollToNameAnchor() 
{
	var nameAnchor = window.location.href;
	var value = nameAnchor.split("nameAnchor=");
	
	if (value[1] != null) { 
		document.location =value[0]+"#"+ value[1];
	}
}


function ajaxGet(url, responseHandler)
{
	var page_request = false;
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){
			}
		}
	}
	else {
		alert("Your browser does not support XMLHTTP.");
		return false;
	}
	
	page_request.onreadystatechange=function() {
		if(page_request.readyState==4) {
                        // on local machines the status for success is 0. on web servers it is 200
			if(page_request.status==200 || page_request.status==0) {
				responseHandler(page_request);
			}
		}
	}
	
	page_request.open('GET', url, true);
	page_request.send(null);
}

function showHideTOC(showTOC)
{
	var toc = document.getElementById("toc");
	var splitter = document.getElementById("splitter");
	var content = document.getElementById("content");
	var showtoc = document.getElementById("showtoc");
	var hidetoc = document.getElementById("hidetoc");
	if(toc)
	{			
		if(!showTOC)
		{
			eval("toc.style.display =''");
			eval("splitter.style.display =''");
			content.style.left ='6px';
			eval("showtoc.style.display =''");
			eval("hidetoc.style.display ='none'");
			setView("hidetoc");
		}
		else
		{
			eval("toc.style.display ='inline'");
			eval("splitter.style.display ='inline'");
			toc.style.width = (splitter.offsetLeft - 20) + 'px';
			content.style.left = (splitter.offsetLeft + 10) + 'px';
			eval("showtoc.style.display ='none'");
			eval("hidetoc.style.display =''");
			setView("showtoc");
		}
	}
}

		  
function splitterMouseDown(event, obj){
	if(!splitterActiveFlag){
		if(obj.setCapture)
			obj.setCapture();
		else {
			document.addEventListener('mouseup', splitterMouseUp, true);
			document.addEventListener('mousemove', splitterMouseMove, true);
			event.preventDefault();
		}
		
		splitterActiveFlag = true ;
		splitterObj = obj;
	}
}
function splitterMouseUp(event){
	if(splitterActiveFlag){
		var objLeft = document.getElementById("toc") ; 
		var objRight = document.getElementById("content") ;
		objLeft.style.width = (splitterObj.offsetLeft - 20) + "px" ;
		objRight.style.left = (splitterObj.offsetLeft + 10) + "px" ; 
		
		if(splitterObj.releaseCapture)
			splitterObj.releaseCapture();
		else {
			document.removeEventListener('mouseup', splitterMouseUp, true);
			document.removeEventListener('mousemove', splitterMouseMove, true);
			event.preventDefault();
		}
		
		splitterActiveFlag = false ;
		saveSplitterPos();
	}

}

function splitterMouseMove(event){
	if(splitterActiveFlag){
		if (event.clientX >= MIN_LEFT && event.clientX <= document.body.clientWidth - MIN_RIGHT) {
			splitterObj.style.left = event.clientX + "px" ;
			if(!splitterObj.releaseCapture) {
				event.preventDefault();
			}
		}
	}
}

/*----------------------------------------------------- helper JS -----------------------------------------------------*/
function setStyle(theObj, styleName, styleValue, priority) {
  var bSuccess = false;

  try {
    if (theObj.style && theObj.style.setProperty) {
      theObj.style.setProperty(styleName, styleValue,priority);
      bSuccess = true;
    }
  } catch (ex) {
    alert('exception caught setting style: ' + ex.message); // cannot do anything try the next method
  }
  if (!bSuccess) {
    try {
      theObj.style[styleName] = styleValue;
      bSuccess = true;
    } catch (exNext) {
      alert('exception caught setting direct style: ' + exNext.message); // cannot do anything
    }
  }
  return bSuccess;
} // end of setStyle

// global to store the item to be focused
gFocusItem =null;
gLastFocusItem = null;
function doFocus()
{
  if (gFocusItem != null) {
    gFocusItem.focus();
    if (gLastFocusItem && gLastFocusItem.className == 'item focus')
      gLastFocusItem.className = 'item';
    if (gFocusItem && gFocusItem.className == 'item')
      gFocusItem.className = 'item focus';
    gLastFocusItem = gFocusItem;
    gFocusItem=null;
  }
}

// Adobe Help versions pod
var ahpodjs = "/en_US/shared/ahpods/AHPod.js";
document.write('<script src="' + ahpodjs + '"type="text/javascript" language="Javascript" charset="UTF-8"></scr'+'ipt>');

function savePackageListScrollTop() {
	var packageList = document.getElementById("packagelist");
	if (packageList) {
		setCookie("packageListScrollTop",packageList.scrollTop, new Date(3000,1,1,1,1), "/", document.location.domain);
		setCookie("classListScrollTop",0, new Date(3000,1,1,1,1), "/", document.location.domain);
	}
}

function saveClassListScrollTop() {
	var classList = document.getElementById("classlist");
	if (classList)
		setCookie("classListScrollTop",classList.scrollTop, new Date(3000,1,1,1,1), "/", document.location.domain);
}

function restorePackageListScrollTop() {
	var packageListScrollTop = getCookie("packageListScrollTop");
	if(packageListScrollTop)
		document.getElementById("packagelist").scrollTop = packageListScrollTop;
}

function restoreClassListScrollTop() {
	var classListScrollTop = getCookie("classListScrollTop");
	if(classListScrollTop)
		document.getElementById("classlist").scrollTop = classListScrollTop;
}
	
function saveSplitterPos() {
	var splitter = document.getElementById("splitter");
	if (splitter)
		setCookie("splitterPosition",splitter.offsetLeft, new Date(3000,1,1,1,1), "/", document.location.domain);
}

function restoreSplitterPos() {
	var splitterPosition = getCookie("splitterPosition");
	if(splitterPosition)
		document.getElementById("splitter").style.left = splitterPosition + "px";
}
