//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function PopUp(ref)
{
	var strFeatures="toolbar=no,status=no,menubar=no,location=no"
	strFeatures=strFeatures+",scrollbars=yes,resizable=yes,height=589,width=678"
	
	newWin = window.open(ref, "TellObj",strFeatures);
	newWin.opener = top;
}

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 = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  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_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  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 "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      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;
}

//Pop-Up Window Code //
function Open(page) 
{
	openwindow = this.open(page, "newWindow", "menubar = yes, scrollbars = yes, resizable = 1, width = 650, height = 500");
}


/****************************************************************************************
'
' JAVASCRIPT.JS
'
' Name:         NavCategories.js
' Description:  Handles toggling of viewby section buttons and Hide/Show description 
'               buttons
'           
*****************************************************************************************
'
' FUNCTIONS
'
' Name:         getCWSObj
' Description:  Retrieves the object passed in the parameter
' Accepts:      id name of html object
' Returns:      html object
'
' ...
'
' Name:         setInitialCWSPageState
' Description:  Initializes the toggling of the viewby sections of the posting
' Accepts:      N/A
' Returns:      N/A
'
' ...
'
' Name:         SetActiveSection
' Description:  Displays the section passed and hides all the remaining sections of
'               the posting. 
' Accepts:      obj - selected section
' Returns:      N/A
'
' ...
'
' Name:         SetActiveButton
' Description:  Changes the style of the active section button and reverts the style
'               of the inactive sections.               
' Accepts:      obj - selected section
' Returns:      N/A
'
' ...
'
' Name:         readCWSCookie
' Description:  Reads cookie info for current active section               
' Accepts:      name - cookie name
' Returns:      N/A
'
' ...
'
' Name:         writeCWSCookie
' Description:  Creates cookie that will store current active section
' Accepts:      name - cookie name
                value - section name
                hours - expiry of cookie
' Returns:      N/A
'
' Name:         doBookmark
' Description:  toggles the anchor sections based from section parameter passed
' Accepts:      url - anchor name
' Returns:      N/A
'
*****************************************************************************************
'
' REVISION HISTORY
'
' Date Created: 03/15/2005
' Author:       Reginald T. Gineta
' 
' Revision Date      Author         Description
' -------------      ------         -----------
'
'
'
****************************************************************************************/
var arrSectionName = new Array("Section1","Section1-2","Section2","Section2-2","Section3","Section3-2","Section4","Section4-2","Section5","Section5-2","Section6","Section6-2");
var arrButtonName = new Array("SectionButton1","SectionButton2","SectionButton3","SectionButton4","SectionButton5","SectionButton6");

 function ResetCookie()
{	
	writeCWSCookie("ActiveButton", "");
	writeCWSCookie("ActiveSection", "");
}


/* Funtion for finding HTML Control */
function getCWSObj(id) 
{
	if (document.getElementById) {
		return document.getElementById(id);
        }
	else if (document.all) {
		return document.all[id];
        }
}

/* Funtion for Setting the initial state of the page */
function setInitialCWSPageState()
{
if (getCWSObj('rendered'))
{
	SetActiveSection(getCWSObj(readCWSCookie('ActiveSection')));
	SetActiveButton(getCWSObj(readCWSCookie('ActiveButton')));
}
}

/* function for setting the active sections */
function SetActiveSection(obj)
{
/* Declare Section state value */
var Hide='none';
var Show='';
var maxNoOfButtons = 10;


/* Iterate to child of buttons control */
if (obj==null) obj = getCWSObj('Section1');

for (var i = 0;i<=maxNoOfButtons;i++)
{
	 if (getCWSObj(arrSectionName[i])==null) return;

	 /* test if current buttons id is not equal to arguments obj id then hide the current content and set current buttons to inactive, else show the current section and set the current buttons to active */
	 if (arrSectionName[i]!=obj.id) 
     {
       getCWSObj(arrSectionName[i]).style.display  = Hide;
     }
     else
      {
        getCWSObj(arrSectionName[i]).style.display  = Show;
        writeCWSCookie("ActiveSection", arrSectionName[i]);
       }
}

}	

/* function for setting the active buttons */
function SetActiveButton(obj)
{

var maxNoOfButtons = 10;

/* Iterate to child of buttons control */
if (obj==null) obj = getCWSObj('SectionButton1');

for (var i = 0;i<=maxNoOfButtons-1;i++)
{
	 if (getCWSObj(arrButtonName[i])==null) return;

	 /* test if current buttons id is not equal to arguments obj id then hide the current content and set current buttons to inactive, else show the current section and set the current buttons to active */
     if (arrButtonName[i]!=obj.id) 
     {
    	getCWSObj(arrButtonName[i]).className = ''; 
     }
     else
      {
    	getCWSObj(arrButtonName[i]).className = 'bodload';
        writeCWSCookie("ActiveButton", arrButtonName[i]);
       }
}

}	
