
//GLOBAL
var ScrollBarWidth;
pagePreLoad();


//PRE STARTUP
function pagePreLoad() {
    //CALL CUFON
    Cufon.replace('h1', { fontFamily: "Lucida Grande" });
    Cufon.replace('h1 strong', { fontFamily: "Lucida Grande Bold" });
    Cufon.replace('h2', { fontFamily: "Lucida Grande Bold" });
}

//ASPAJAX START UP
function pageLoad() {
    
    //GLOBALS
    ScrollBarWidth = getScrollBarWidth();
    CheckScrollbar();
    
    //INDI CALLS
    try {
        document.getElementById("ctl00_ctl00_ContentContainer").style.display = "block";
        pageLoadIndividual();
    } catch (Error) {
        //NOTHING
    }

    try {
        parent.UpdateURI(CurrentPageURI);
    } catch (Error) { }
    // KEYPRESS DINGDING
//    document.body.onkeypress = function() {
//        if (event.keyCode == 13) return false;
//    }

}

//UN ONLOAD
$(window).unload(function() {
    try {
        parent.ShowLayOver();
    } catch (Error) { }
});

//SITE LOADED
function loadComplete() {
    //CUFON IEXPLORE NOW
    Cufon.now();
    AvoidDottedOutline();
}


//PERFORM BEFORE POST BACK
function beforePostBack() {

}

//PERFORM AFTER POST BACK
function afterPostBack() {
    CheckScrollbar();
    AvoidDottedOutline();
    Cufon.now();
}

//EVENTS
window.onresize = function(event) {
    CheckScrollbar();
}

//FUNCTIONS
function CheckScrollbar(Force) {
    try {
        if (Force =="deactivate") { //DEACTIVATE FORCING FOR NOW
            if (Force == "small") {
                document.getElementById("ctl00_ctl00_ContainerExtender").style.width = "990px";
            }
            if (Force == "wide") {
                document.getElementById("ctl00_ctl00_ContainerExtender").style.width = ScrollBarWidth + 990 + "px";
            }
        } else {
            if (document.body.scrollHeight > document.body.clientHeight) {
                document.getElementById("ctl00_ctl00_ContainerExtender").style.width = "990px";
            }
            else {
                document.getElementById("ctl00_ctl00_ContainerExtender").style.width = ScrollBarWidth + 990 + "px";
            }
        }
    } catch (Error) {
        //NOTHING
    }
}
function getScrollBarWidth() {
    var inner = document.createElement('p');
    inner.style.width = "100%";
    inner.style.height = "200px";

    var outer = document.createElement('div');
    outer.style.position = "absolute";
    outer.style.top = "0px";
    outer.style.left = "0px";
    outer.style.visibility = "hidden";
    outer.style.width = "200px";
    outer.style.height = "150px";
    outer.style.overflow = "hidden";
    outer.appendChild(inner);

    document.body.appendChild(outer);
    var w1 = inner.offsetWidth;
    outer.style.overflow = 'scroll';
    var w2 = inner.offsetWidth;
    if (w1 == w2) w2 = outer.clientWidth;

    document.body.removeChild(outer);

    return (w1 - w2);
};

function ShowRadicalRadio(olid) {
    window.open('http://rr.therainmakernetwork.org/default.aspx?olid=' + olid, 'RRWindowPlayer', 'height=305,width=550');
    return false;
}

function keyPressHandler(e, fn) {
    var kC = (window.event) ?    // MSIE or Firefox?
                 event.keyCode : e.keyCode;
    var Esc = (window.event) ?
                27 : e.DOM_VK_ESCAPE;  // MSIE : Firefox
    if (kC == Esc) {
        eval(fn);
    }
}

function eR(id) {
    return document.getElementById(id);
}
function AvoidDottedOutline() {
    if (document.getElementsByTagName) {
        var a = document.getElementsByTagName("a");
        for (var i = 0; i < a.length; i++) {
            a[i].onfocus = function() { this.blur(); };
        }
    }
}

function EasyHideElement(d) {
    $("#" + d).css('display', 'none');
}

function EasyShowElement(d) {
    $("#" + d).css('display', 'block');
}

function TextCount(Input, Output, Max, PreText) {
    if ($("#" + Input).val().length > Max) {
        $("#" + Input).val($("#" + Input).val().substring(0, Max));
    } else {
        $("#" + Output).val(PreText + (Max - $("#" + Input).val().length));
    }
} 


function pageWidth() { return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; }
function pageHeight() { return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null; }
function posTop() { return typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0; }


function DoNavigate(eTarget) {
    try {
        parent.Navigate(eTarget);
    } catch (Error) {
        if (window.location.href == undefined) {
            window.self.navigate(eTarget);
        } else {
            window.location.href = eTarget;
        }
    } 
}

//INITIALIZE CAROUSELS
var CarouselBenefitsIsInitialized;
function InitializeCarouselBenefits() {
    if (CarouselBenefitsIsInitialized != true) {
        $(".ArrowStudent").css("display", "inline");
        $(".ArrowCompany").css("display", "none");
        $(".ArrowGlobal").css("display", "none");  
        
        $(function() {
            $(".BenefitsCarousel").jCarouselLite({
                visible: 1,
                start: 0,
                circular: false,
                beforeStart: function(a) {

                },
                afterEnd: function(a) {
                    ChangeBenefitsInfoGrafix(a[0].id);
                },
                btnGo:
                [".jumpBenefitsA", ".jumpBenefitsB", ".jumpBenefitsC"]
            });
        });
        CarouselBenefitsIsInitialized = true;
    }

}

var CarouselAboutIsInitialized;
function InitializeCarouselAbout() {
    if (CarouselAboutIsInitialized != true) {
        $(".ArrowAbout").css("display", "inline");
        $(".ArrowMission").css("display", "none");
        $(".ArrowTeam").css("display", "none");

        $(function() {
            $(".AboutCarousel").jCarouselLite({
                visible: 1,
                start: 0,
                circular: false,
                beforeStart: function(a) {
                    $(".ArrowAbout").css("display", "none");
                    $(".ArrowMission").css("display", "none");
                    $(".ArrowTeam").css("display", "none");
                },
                afterEnd: function(a) {
                    ChangeAboutInfoGrafix(a[0].id);
                },
                btnGo:
                [".jumpAboutA", ".jumpAboutB", ".jumpAboutC"]
            });
        });
        CarouselAboutIsInitialized = true;
    }

}

var CarouselEmployeeIsInitialized;
function InitializeEmployeesCarousel() {
    if (CarouselEmployeeIsInitialized != true) {
    
        $(function() {
            $(".EmployeeCarousel").jCarouselLite({

                visible: 8,
                auto: 800,
                speed: 1000,
                start: 0,
                scroll: 1,
                buttonscroll: 8,
                beforeStart: function(a) {

                }
            });
        });

        CarouselEmployeeIsInitialized = true;
    }

}



function ChangeBenefitsInfoGrafix(actual) {
    $(".ArrowStudent").css("display", "none");
    $(".ArrowCompany").css("display", "none");
    $(".ArrowGlobal").css("display", "none");
    switch (actual) {
        case "students":
            $(".ArrowStudent").css("display", "inline");
            break;
        case "company":
            $(".ArrowCompany").css("display", "inline");
            break;
        case "global":
            $(".ArrowGlobal").css("display", "inline");
            break;
    }
}

function ChangeAboutInfoGrafix(actual) {
    $(".ArrowAbout").css("display", "none");
    $(".ArrowMission").css("display", "none");
    $(".ArrowTeam").css("display", "none");
    switch (actual) {
        case "aboutus":
            $(".ArrowAbout").css("display", "inline");
            break;
        case "missionstatement":
            $(".ArrowMission").css("display", "inline");
            break;
        case "ourteam":
            $(".ArrowTeam").css("display", "inline");
            break;
    }
}

function UnderlineMe(obj, cssclass) {
    $("." + cssclass).css("text-decoration", "none");
    $(obj).css("text-decoration", "underline");
}
var ScrollBarWidth;pagePreLoad();function pagePreLoad(){Cufon.replace('h1',{fontFamily:"Lucida Grande"});Cufon.replace('h1 strong',{fontFamily:"Lucida Grande Bold"});Cufon.replace('h2',{fontFamily:"Lucida Grande Bold"});}
function pageLoad(){ScrollBarWidth=getScrollBarWidth();CheckScrollbar();try{document.getElementById("ctl00_ctl00_ContentContainer").style.display="block";pageLoadIndividual();}catch(Error){}
try{parent.UpdateURI(CurrentPageURI);}catch(Error){}}
$(window).unload(function(){try{parent.ShowLayOver();}catch(Error){}});function loadComplete(){Cufon.now();AvoidDottedOutline();}
function beforePostBack(){}
function afterPostBack(){CheckScrollbar();AvoidDottedOutline();Cufon.now();}
window.onresize=function(event){CheckScrollbar();}
function CheckScrollbar(Force){try{if(Force=="deactivate"){if(Force=="small"){document.getElementById("ctl00_ctl00_ContainerExtender").style.width="990px";}
if(Force=="wide"){document.getElementById("ctl00_ctl00_ContainerExtender").style.width=ScrollBarWidth+990+"px";}}else{if(document.body.scrollHeight>document.body.clientHeight){document.getElementById("ctl00_ctl00_ContainerExtender").style.width="990px";}
else{document.getElementById("ctl00_ctl00_ContainerExtender").style.width=ScrollBarWidth+990+"px";}}}catch(Error){}}
function getScrollBarWidth(){var inner=document.createElement('p');inner.style.width="100%";inner.style.height="200px";var outer=document.createElement('div');outer.style.position="absolute";outer.style.top="0px";outer.style.left="0px";outer.style.visibility="hidden";outer.style.width="200px";outer.style.height="150px";outer.style.overflow="hidden";outer.appendChild(inner);document.body.appendChild(outer);var w1=inner.offsetWidth;outer.style.overflow='scroll';var w2=inner.offsetWidth;if(w1==w2)w2=outer.clientWidth;document.body.removeChild(outer);return(w1-w2);};function ShowRadicalRadio(olid){window.open('http://rr.therainmakernetwork.org/default.aspx?olid='+olid,'RRWindowPlayer','height=305,width=550');return false;}
function keyPressHandler(e,fn){var kC=(window.event)?event.keyCode:e.keyCode;var Esc=(window.event)?27:e.DOM_VK_ESCAPE;if(kC==Esc){eval(fn);}}
function eR(id){return document.getElementById(id);}
function AvoidDottedOutline(){if(document.getElementsByTagName){var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){a[i].onfocus=function(){this.blur();};}}}
function EasyHideElement(d){$("#"+d).css('display','none');}
function EasyShowElement(d){$("#"+d).css('display','block');}
function TextCount(Input,Output,Max,PreText){if($("#"+Input).val().length>Max){$("#"+Input).val($("#"+Input).val().substring(0,Max));}else{$("#"+Output).val(PreText+(Max-$("#"+Input).val().length));}}
function pageWidth(){return window.innerWidth!=null?window.innerWidth:document.documentElement&&document.documentElement.clientWidth?document.documentElement.clientWidth:document.body!=null?document.body.clientWidth:null;}
function pageHeight(){return window.innerHeight!=null?window.innerHeight:document.documentElement&&document.documentElement.clientHeight?document.documentElement.clientHeight:document.body!=null?document.body.clientHeight:null;}
function posTop(){return typeof window.pageYOffset!='undefined'?window.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop?document.body.scrollTop:0;}
function DoNavigate(eTarget){try{parent.Navigate(eTarget);}catch(Error){if(window.location.href==undefined){window.self.navigate(eTarget);}else{window.location.href=eTarget;}}}
var CarouselBenefitsIsInitialized;function InitializeCarouselBenefits(){if(CarouselBenefitsIsInitialized!=true){$(".ArrowStudent").css("display","inline");$(".ArrowCompany").css("display","none");$(".ArrowGlobal").css("display","none");$(function(){$(".BenefitsCarousel").jCarouselLite({visible:1,start:0,circular:false,beforeStart:function(a){},afterEnd:function(a){ChangeBenefitsInfoGrafix(a[0].id);},btnGo:[".jumpBenefitsA",".jumpBenefitsB",".jumpBenefitsC"]});});CarouselBenefitsIsInitialized=true;}}
var CarouselAboutIsInitialized;function InitializeCarouselAbout(){if(CarouselAboutIsInitialized!=true){$(".ArrowAbout").css("display","inline");$(".ArrowMission").css("display","none");$(".ArrowTeam").css("display","none");$(function(){$(".AboutCarousel").jCarouselLite({visible:1,start:0,circular:false,beforeStart:function(a){$(".ArrowAbout").css("display","none");$(".ArrowMission").css("display","none");$(".ArrowTeam").css("display","none");},afterEnd:function(a){ChangeAboutInfoGrafix(a[0].id);},btnGo:[".jumpAboutA",".jumpAboutB",".jumpAboutC"]});});CarouselAboutIsInitialized=true;}}
var CarouselEmployeeIsInitialized;function InitializeEmployeesCarousel(){if(CarouselEmployeeIsInitialized!=true){$(function(){$(".EmployeeCarousel").jCarouselLite({visible:8,auto:800,speed:1000,start:0,scroll:1,buttonscroll:8,beforeStart:function(a){}});});CarouselEmployeeIsInitialized=true;}}
function ChangeBenefitsInfoGrafix(actual){$(".ArrowStudent").css("display","none");$(".ArrowCompany").css("display","none");$(".ArrowGlobal").css("display","none");switch(actual){case"students":$(".ArrowStudent").css("display","inline");break;case"company":$(".ArrowCompany").css("display","inline");break;case"global":$(".ArrowGlobal").css("display","inline");break;}}
function ChangeAboutInfoGrafix(actual){$(".ArrowAbout").css("display","none");$(".ArrowMission").css("display","none");$(".ArrowTeam").css("display","none");switch(actual){case"aboutus":$(".ArrowAbout").css("display","inline");break;case"missionstatement":$(".ArrowMission").css("display","inline");break;case"ourteam":$(".ArrowTeam").css("display","inline");break;}}
function UnderlineMe(obj,cssclass){$("."+cssclass).css("text-decoration","none");$(obj).css("text-decoration","underline");};
