// ****************************************************************************
// Main Menu Drop Down Scripts [BEGIN]
// ****************************************************************************

var cssdropdown = {
disappeardelay: 250,    //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: true, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1,         //enable swipe effect? 1 for yes, 0 for no


// FH:GRC - Added function for menu roll-over - requires [image names "*_over.*"] && [image id's "*_img"]
menuImgSwap:function(imgID,on){
obj=document.getElementById(imgID+'_img');
if (obj) {
slsh=obj.src.lastIndexOf("/");
dot=obj.src.lastIndexOf(".");
srcdir=obj.src.substr(0,slsh+1);
imgname=obj.src.substr(slsh+1,(dot-(slsh+1)));
imgext=obj.src.substr(dot);
if(imgname.lastIndexOf('_over')==-1&&on){ obj.src = srcdir+imgname+'_over'+imgext; }
else if(imgname.lastIndexOf('_over')>0&&!on) { 

if (imgID == 'drop1' | imgID == 'drop2' | imgID == 'drop3'){
obj.src = srcdir+(imgname.substr(0,imgname.length-5))+imgext; Currentstate(CimgID); }
else {obj.src = srcdir+(imgname.substr(0,imgname.length-5))+imgext;}

}
}
},



//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : 

document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 

: window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 

: window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){

if (this.dropmenuobj!=null) {//hide previous menu
 
this.menuImgSwap(this.dropmenuobj.id,false);
this.dropmenuobj.style.visibility="hidden"; //hide menu

}
this.clearhidemenu();

this.menuImgSwap(dropmenuID,true);

if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu();}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu();}

//alert (dropmenuID);
if (dropmenuID == 'drop1' | dropmenuID == 'drop2' | dropmenuID == 'drop3'){
    this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide1(e);}
    this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu1()}
}
else {
    this.dropmenuobj.onmouseout=function(){cssdropdown.dynamichide(e);}
    this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
}



this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, 

"bottomedge")+obj.offsetHeight+1+"px"
}
DivSetVisible(true, dropmenuID); ////fix for ie dropdown over select
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& 

!this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden';cssdropdown.menuImgSwap(cssdropdown.dropmenuobj.id,false);",this.disappeardelay) //hide menu
},

/////////edit for stockdat drop down
dynamichide1:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu1()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& 

!this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu1()
},

delayhidemenu1:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden';cssdropdown.menuImgSwap(cssdropdown.dropmenuobj.id,false); document.getElementById('DivShim1').style.display = 'none';",this.disappeardelay) //hide menu
},

///////////////////////edit done


clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startmainmenu:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e){

var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
}
}
 
 function DivSetVisible(state, relvalue)
  {
   //var DivID = this.getAttribute("rel");
   
   if (relvalue == 'drop1' | relvalue == 'drop2' | relvalue == 'drop3'){
   
   //document.write (relvalue);
   var DivRef = document.getElementById(relvalue);
   var IfrRef = document.getElementById('DivShim1');
   if(state)
   { 
       //alert(DivRef.style.left);
       IfrRef.style.width = DivRef.offsetWidth;
    IfrRef.style.height = DivRef.offsetHeight;
    IfrRef.style.top = DivRef.style.top;
    IfrRef.style.left = DivRef.style.left;
    IfrRef.style.zIndex = DivRef.style.zIndex - 1;
    IfrRef.style.display = "block";
    DivRef.style.visibility ="visible";   
    DivRef.style.display = "block";

   }
   
   else
   {   
       IfrRef.style.display = "none";
    DivRef.style.display = "none";
 
   }
  }
  }

function page(num)
{
    switch(num) {
    case 1:
        location.href = "/";
        break;
    case 2:
        location.href = "/about/Pages/overview.php";
        break;
    case 3:
        location.href = "/scholarships-and-grants/scholarships-and-grants.php";
        break;
    case 4:
        location.href = "/how-you-can-help/Pages/donate.php";
        break;
    case 6:
        location.href = "/press-room/";
        break;
    }
}


function fhrenderTopMenu() {

    document.write('<!-- BEGIN MAIN TOP MENU -->\n');
    document.write('<div class="dropdownstyle" id="dropdownmenu">\n');
    document.write('<a href="/" title="PUSD Special Education Foundation" rel="dropmenu1"><img src="/images/navbar_01.gif" onclick="page(1)" width="64" height="46" border="0" id="dropmenu1_img" alt="PUSD Special Education Foundation"></a><a href="/about/Pages/overview.php" rel="dropmenu2" title="About the PUSD Special Education Foundation"><img src="/images/navbar_02.gif" onclick="page(2)" id="dropmenu2_img" width="160" height="46" border="0" alt="About the PUSD Special Education Foundation"></a><a href="/scholarships-and-grants/scholarships-and-grants.php" rel="dropmenu3" title="Scholarships and Grants"><img src="/images/navbar_03.gif" onclick="page(3)" id="dropmenu3_img" width="160" height="46" border="0" alt="Scholarships and Grants"></a><a href="/how-you-can-help/Pages/donate.php" rel="dropmenu4" title="How You Can Help"><img src="/images/navbar_04.gif" onclick="page(4)" id="dropmenu4_img" width="134" height="46" border="0" alt="How You Can Help"></a>\n');
    document.write('</div>\n');
    document.write('\n');
    document.write('<!--1st drop down menu -->\n');
    document.write('<div id="dropmenu1" class="dropmenudiv" style="width: 200px;">\n');
    document.write('<a href="/">PUSD Special Education Foundation</a>\n');
    document.write('</div>\n');
    document.write('\n');
    document.write('<!--2nd drop down menu -->\n');
    document.write('<div id="dropmenu2" class="dropmenudiv" style="width: 160px;">\n');
    document.write('<a href="/about/Pages/overview.php" title="Overview">Overview</a>\n');
    document.write('<a href="/about/Pages/our-mission.php" title="Our Mission">Our Mission</a>\n');
    document.write('<a href="/about/Pages/directors.php" title="Board of Directors">Board of Directors</a>\n');
    document.write('<a href="/about/Pages/our-partners.php" title="Our Partners">Our Partners</a>\n');
    document.write('<a href="/about/Pages/contact-us.php" title="Contact Us">Contact Us</a>\n');
    document.write('</div>\n');
    document.write('\n');
	document.write('<!--3rd drop down menu -->\n');
    document.write('<div id="dropmenu3" class="dropmenudiv" style="width: 160px;">\n');
    document.write('<a href="/scholarships-and-grants/scholarships-and-grants.php" title="Scholarships and Grants">Scholarships and Grants</a>\n');
    document.write('</div>\n');
    document.write('\n');
	document.write('<!--4th drop down menu -->\n');
    document.write('<div id="dropmenu4" class="dropmenudiv" style="width: 163px;">\n');
    document.write('<a href="/how-you-can-help/Pages/donate.php" title="Make a Donation">Make a Donation</a>\n');
    document.write('<a href="/how-you-can-help/Pages/meetings.php" title="Attend a Meeting">Attend a Meeting</a>\n');
    document.write('<a href="/how-you-can-help/Pages/events.php" title="Calendar of Events">Calendar of Events</a>\n');
    document.write('<a href="/how-you-can-help/Pages/apple-awards.php" title="Red Apple Awards">Red Apple Awards</a>\n');
    document.write('</div>\n');
    document.write('\n');
    document.write('<script type="text/javascript">\n');
    document.write('cssdropdown.startmainmenu("dropdownmenu")\n');
    document.write('</script>\n');
    document.write('<!-- END MAIN TOP MENU -->\n');

}



// END TOP NAVIGATION


// Main Menu Drop Down Scripts [END]
// ****************************************************************************

// ****************************************************************************
// Flash Embed Script [BEGIN]
// ****************************************************************************

/**
 * SWFObject v1.4.1: 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 formerly 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(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
    if (!document.createElement || !document.getElementById) { return; }
    this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
    this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    this.params = new Object();
    this.variables = new Object();
    this.attributes = new Array();
    if(swf) { this.setAttribute('swf', swf); }
    if(id) { this.setAttribute('id', id); }
    if(w) { this.setAttribute('width', w); }
    if(h) { this.setAttribute('height', h); }
    if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
    this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion(this.getAttribute('version'), useExpressInstall);
    if(c) { this.addParam('bgcolor', c); }
    var q = quality ? quality : 'high';
    this.addParam('quality', q);
    this.setAttribute('useExpressInstall', useExpressInstall);
    this.setAttribute('doExpressInstall', false);
    var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
    this.setAttribute('xiRedirectUrl', xir);
    this.setAttribute('redirectUrl', '');
    if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
    setAttribute: function(name, value){
        this.attributes[name] = value;
    },
    getAttribute: function(name){
        return this.attributes[name];
    },
    addParam: function(name, value){
        this.params[name] = value;
    },
    getParams: function(){
        return this.params;
    },
    addVariable: function(name, value){
        this.variables[name] = value;
    },
    getVariable: function(name){
        return this.variables[name];
    },
    getVariables: function(){
        return this.variables;
    },
    getVariablePairs: function(){
        var variablePairs = new Array();
        var key;
        var variables = this.getVariables();
        for(key in variables){
            variablePairs.push(key +"="+ variables[key]);
        }
        return variablePairs;
    },
    getSWFHTML: function() {
        var swfNode = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
            if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "PlugIn");
            swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
            swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
            var params = this.getParams();
             for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
            var pairs = this.getVariablePairs().join("&");
             if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
            swfNode += '/>';
        } else { // PC IE
            if (this.getAttribute("doExpressInstall")) this.addVariable("MMplayerType", "ActiveX");
            swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
            swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
            var params = this.getParams();
            for(var key in params) {
             swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
            }
            var pairs = this.getVariablePairs().join("&");
            if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
            swfNode += "</object>";
        }
        return swfNode;
    },
    write: function(elementId){
        if(this.getAttribute('useExpressInstall')) {
            // check to see if we need to do an express install
            var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
            if (this.installedVer.versionIsValid(expressInstallReqVer) && !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 elementId == 'string') ? document.getElementById(elementId) : elementId;
            n.innerHTML = this.getSWFHTML();
            return true;
        }else{
            if(this.getAttribute('redirectUrl') != "") {
                document.location.replace(this.getAttribute('redirectUrl'));
            }
        }
        return false;
    }
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(reqVer, xiInstall){
    var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
    if(navigator.plugins && navigator.mimeTypes.length){
        var x = navigator.plugins["Shockwave Flash"];
        if(x && x.description) {
            PlayerVersion = 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);
                PlayerVersion = new deconcept.PlayerVersion([i,0,0]);
            }
        }catch(e){}
        if (reqVer && PlayerVersion.major > reqVer.major) return PlayerVersion; // version is ok, skip minor detection
        // this only does the minor rev lookup if the user's major version
        // is not 6 or we are checking for a specific minor or revision number
        // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
        if (!reqVer || ((reqVer.minor != 0 || reqVer.rev != 0) && PlayerVersion.major == reqVer.major) || PlayerVersion.major != 6 || xiInstall) {
            try{
                PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
            }catch(e){}
        }
    }
    return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
    this.major = parseInt(arrVersion[0]) != null ? parseInt(arrVersion[0]) : 0;
    this.minor = parseInt(arrVersion[1]) || 0;
    this.rev = parseInt(arrVersion[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;
}
/* ---- get value of query string param ---- */
deconcept.util = {
    getRequestParameter: function(param){
        var q = document.location.search || document.location.hash;
        if(q){
            var startIndex = q.indexOf(param +"=");
            var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
            if (q.length > 1 && startIndex > -1) {
                return q.substring(q.indexOf("=", startIndex)+1, endIndex);
            }
        }
        return "";
    }
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
    var objects = document.getElementsByTagName("OBJECT");
    for (var i=0; i < objects.length; i++) {
        for (var x in objects[i]) {
            if (typeof objects[i][x] == 'function') {
                objects[i][x] = null;
            }
        }
    }
}
if (typeof window.onunload == 'function') {
    var oldunload = window.onunload;
        window.onunload = function() {
        deconcept.SWFObjectUtil.cleanupSWFs();
        oldunload();
    }
} else {
    window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; 

return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

// Flash Embed Script [END]
// ****************************************************************************