﻿function brandPop( url ) {
	    wPop( url,"brand",650,440,'yes' );
}

function wPop(url, winName, wWidth, wHeight, scrll)
{
    var scrollB;
    if(!scrll)
    {
      scrollB = 'no';
      var pWidth = wWidth;
      var rSize = 'no'
    }
    else 
    {
      scrollB = scrll;
      wWidth = parseInt(wWidth) + 20;
      var rSize = 'yes'
    }
    var iMyWidth;
    var iMyHeight;
    wHeight = wHeight + 12;
    //Added twelve pixels to ALL popup heights to compensate for newer/larger popup header logo. 
    iMyWidth =(window.screen.width / 2) - (wWidth / 2 + 10);
    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyHeight =(window.screen.height /2) - (wHeight / 2 + 15);
    //half the screen height minus half the new window height (plus title and status bars).
    var zWin = window.open(url, winName, "status=no,width=" + wWidth + ",height=" + wHeight + ",resizable=" + rSize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + scrollB);
    zWin.focus();
}

 function changeSlogan(myNum, classpassed) 
    {
        if ($("revealOne"))
        {
            if(myNum == 1){
	            $("revealOne").hide();
	            $('thumb01').className = 'roll01a';
	            $("revealTwo").hide();
	            $('thumb02').className = 'roll02';
	            $("revealThree").hide();
	            $('thumb03').className = 'roll03';
	        }
            else if(myNum == 2){
                $("revealTwo").show();
                $('thumb02').className = 'roll02a';
                $("revealOne").hide();
                $('thumb01').className = 'roll01';
                $("revealThree").hide();
                $('thumb03').className = 'roll03';
            }
            else if(myNum == 3){
                $("revealThree").show();
                $('thumb03').className = 'roll03a';
                $("revealOne").hide();
                $('thumb01').className = 'roll01';
                $("revealTwo").hide();
                $('thumb02').className = 'roll02';
            }
            else if(myNum == 0){
            }
        }
    }
    
    Event.observe(window, "load", onloadEvents);
   
   function onloadEvents(){
    
        changeSlogan(1);
   
   }
   
   function initHide(theForm) 
    {
        var divArray = new Array();
        divArray[0] = "engineering";
        divArray[1] = "finance";
        divArray[2] = "marketing";
        divArray[3] = "manufacturing";
        divArray[4] = "orm";
        divArray[5] = "checkmark";
        divArray[6] = "technical";
        divArray[7] = "sales";
        
        var selectedValue = $F(theForm);
        if (selectedValue == "finance")
        {
			for (var i=0;i<=divArray.length-1;i++) 
            {
                if(divArray[i] == selectedValue)
                {
                    $(divArray[i]).show();
                }
                else if(divArray[i] != selectedValue)
                {
                    $(divArray[i]).hide();
                }
            }
            $("finance").setStyle({paddingBottom: '90px'});
        }
        else if (selectedValue == "technical")
        {
			for (var i=0;i<=divArray.length-1;i++) 
            {
                if(divArray[i] == selectedValue)
                {
                    $(divArray[i]).show();
                }
                else if(divArray[i] != selectedValue)
                {
                    $(divArray[i]).hide();
                }
            }
            $("technical").setStyle({paddingBottom: '90px'});
        }
        
        else if (selectedValue == "sales")
        {
			for (var i=0;i<=divArray.length-1;i++) 
            {
                if(divArray[i] == selectedValue)
                {
                    $(divArray[i]).show();
                }
                else if(divArray[i] != selectedValue)
                {
                    $(divArray[i]).hide();
                }
            }
            $("sales").setStyle({paddingBottom: '90px'});
        }
        
        else if (selectedValue != 'all')
        {
            for (var i=0;i<=divArray.length-1;i++) 
            {
                if(divArray[i] == selectedValue)
                {
                    $(divArray[i]).show();
                }
                else if(divArray[i] != selectedValue)
                {
                    $(divArray[i]).hide();
                    $(divArray[i]).setStyle({paddingBottom: '16px'});
                }
            }
        }
        else
        {
           for (var i=0;i<=divArray.length-1;i++) 
           {
                $(divArray[i]).show();
                $(divArray[i]).setStyle({paddingBottom: '16px'});
           }
        }
    }
   
function initMovie(stage_id, starting_movie)
{
	if ( $(stage_id) && $(starting_movie) )
	{
		var flashPresent = startMovie(stage_id, starting_movie);
		if ( $(starting_movie).up('ul') && flashPresent )
		{
			$(starting_movie).up('ul').show();
			var tabs = $(starting_movie).up('ul').select('li');
			for (var i = 0; i < tabs.length; i++)
			{
				Event.observe( tabs[i], "click", triggerMovie.bindAsEventListener(tabs[i], stage_id, tabs[i]) );
			}
		}
		else if (flashPresent == false)
		{
			$(stage_id).insert("<div class='flashText'>Sorry, you will need to <a href='http://www.adobe.com/go/getflashplayer' target='blank'>download</a> or <a href='http://www.adobe.com/go/getflashplayer' target='_blank'>update</a> your Flash Player to watch this movie.</div>");
		}
	
	}
}

function initHomeMovie(stage_id)
{
	if ( $(stage_id) )
	{
		var flashPresent = startHomeMovie(stage_id);
		if ( !(flashPresent) )
			$(stage_id).insert("<div class='flashTextModal'>Sorry, you will need to <a href='http://www.adobe.com/go/getflashplayer' target='_blank'>download</a> or <a href='http://www.adobe.com/go/getflashplayer' target='blank'>update</a> your Flash Player to watch this movie.</div>");
	}
}

function triggerMovie(e, stage_id, current_movie)
{
	Event.stop(e);
	if ( $(current_movie).up('ul') )
		setTabs(current_movie);
	if ( $(current_movie) )
	{
		var moviePath = $(current_movie).down('a').readAttribute('href');
		playMovie(moviePath, stage_id, 390, 248);
	}
}

function startMovie(stage_id, current_movie)
{
	if ( $(current_movie).up('ul') )
		setTabs(current_movie);
	
	if ( $(current_movie) )
	{
		var moviePath = $(current_movie).down('a').readAttribute('href');
		var playStatus = playMovie(moviePath, stage_id, 390, 248);
		return playStatus;
	}
}

function startHomeMovie(stage_id)
{
	if ( $(stage_id) )
	{
		var moviePath = $(stage_id).down('a').readAttribute('href');
		var playStatus = playHomeMovie(moviePath, stage_id, 568, 320);
		return playStatus;
	}
}

function playMovie(path, stage_id, hSize, vSize)
{
	var s1 = new SWFObject(path, "purinaJobsPlayer", hSize, vSize, "8", "#FFFFFF", "high");
	s1.addParam("wmode", "window");
	var flashPresent = s1.write(stage_id);
		return flashPresent;
}

function playHomeMovie(path, stage_id, hSize, vSize)
{
	var s1 = new SWFObject(path, "purinaJobsPlayer", hSize, vSize, "8", "#FFFFFF", "high");
	s1.addParam("wmode", "transparent");
	var flashPresent = s1.write(stage_id);
		return flashPresent;
}


function setTabs(current_movie)
{
	if ( $(current_movie) )
		$(current_movie).setStyle({backgroundImage: 'url(../_res/i/dept/videotab_bg_active.gif)'});
	
	if ( $(current_movie).up('ul') )
	{
		var other_tabs = $(current_movie).siblings();
		other_tabs.invoke("setStyle", {backgroundImage: 'url(../_res/i/dept/videotab_bg.gif)'})
	}
}

function iframeLoadListener(iframeId) {
	if ( $(iframeId) ) {
		Event.observe( iframeId, "load", scrollUp);
	}
}

function scrollUp() {
	if ( $("topPge") )
		$("topPge").scrollTo();
}


document.observe("dom:loaded", function()
	{
		initMovie("ptc_video", "ptc_design");
		initMovie("mkg_video", "mkg_video");
		initMovie("sales_video", "sales_video");
		initMovie("eng_video", "eng_overview");
		initMovie("mfg_video", "mfg_video");
		initMovie("chk_video", "chk_video");
		initMovie("culture_video", "culture_video");
		initMovie("careerdev_video", "careerdev_video");
		initMovie("apa_closer_video", "apa_closer_video");
		initHomeMovie("homeLft");
		iframeLoadListener("search_jobs");
		iframeLoadListener("search_intern");
	}
);
