﻿
//track clickajob clicks, 3=cajsponsored,2=iprofilecompatible,1=normal; 1&2 not implemented
function trackJobSearch(type){
    if (type=='3'){
        pageTracker._trackPageview("/outgoing/faj_cajpaidclicks");
    }
}            

function getPageSizeWithScroll(){
    if (window.innerHeight && window.scrollMaxY)
    {
        // Firefox         
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
     }
     else if (document.body.scrollHeight > document.body.offsetHeight)
    { // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    }
    else
    { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }    
    arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
    //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
    return arrayPageSizeWithScroll;
}

//returns the available height and width of the screen
function getViewPort(){
     var viewportwidth;
     var viewportheight;
     
     // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
     
     if (typeof window.innerWidth != 'undefined')
     {
          viewportwidth = window.innerWidth,
          viewportheight = window.innerHeight
     }
     
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

     else if (typeof document.documentElement != 'undefined'
         && typeof document.documentElement.clientWidth !=
         'undefined' && document.documentElement.clientWidth != 0)
     {
           viewportwidth = document.documentElement.clientWidth,
           //viewportheight = document.documentElement.clientHeight - use offsetHeight instead, seems to work better
           viewportheight = (document.documentElement.clientHeight > document.body.offsetHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
     }
     
     // older versions of IE
     
     else
     {
           viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
           viewportheight = document.getElementsByTagName('body')[0].clientHeight
     }
     arrayViewPort = new Array(viewportwidth,viewportheight);
    //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
    return arrayViewPort;

}

//returns the available size of window, the height betwen the menus at the top and the scrollbar at the bottom, as you see it.
function getWindowSize() {
      var myWidth = 0, myHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
      arrayWindowSize = new Array(myWidth,myHeight);
      return arrayWindowSize;
  
}


function addEvent(obj,type,fn) {
    if (obj.attachEvent) {
        obj['e'+type+fn] = fn;
        obj[type+fn] = function() { obj['e'+type+fn](window.event); }
        obj.attachEvent('on'+type,obj[type+fn]);
    } else
    obj.addEventListener(type,fn,false);
}



function SelectText(theControl)
{
    var a = document.getElementById(theControl);

    if(a)
    {    
        if(a.value.length > 0)
        {
            a.select();
        }
    }
}

var text="Please Wait ...";
var delay=70;
var currentChar=1;
var destination="PleaseWait";

function ShowPleaseWait(pleaseWaitText,complete)
{
    if(complete == 'true')
    {
        var a = document.getElementById('PleaseWait');
        var b = document.getElementById('MainPage');
        var c = document.getElementById('PleaseWaitHdr');

        if(a && b && c)
        {
            a.style.display='block';
            b.style.display='none';
            c.style.display='block';
        }     

        text = pleaseWaitText;

        type();
     }
}

function type()
{
    if (document.getElementById)
    {
        var dest=document.getElementById(destination);

        if (dest)
        {
            dest.innerHTML=text.substr(0, currentChar);
            currentChar++

            if (currentChar>text.length)
            {
               currentChar=1;
               setTimeout("type()", 5000);
            }
            else
            {
               setTimeout("type()", delay);
            }
        }
    }
}

function show(obj,show,delay)
{
    var ttobj = document.getElementById(obj);

    if (!ttobj) return;
    
    if (show)
    {
        ttobj.style.visibility='visible';
    }
    else {ttobj.style.visibility='hidden';}
}
function showHide(obj,show)
{
    var ttobj = document.getElementById(obj);

    if (!ttobj) return;
    
    //ttobj.style.visibility = (ttobj.style.visibility == "visible") ? "hidden" : "visible";
    ttobj.style.display = (ttobj.style.display == "block") ? "none" : "block";

}

function showWrapper() 
{
    var wrapperObj = document.getElementById('wrapper');
    if (wrapperObj) 
    {
        wrapperObj.style.visibility='visible';
    }
}


/*White Label DropDown Menu Functions*/
function setWLMenuVisibility(obj, id)
{
    el = document.getElementById(id);
    myArray = findPos(obj);
    el.style.left = myArray[0] + 'px';
    el.style.top = myArray[1] + 15 + 'px';
    show(id,true,null);
}


function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent)
    {
        do 
        {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        } 
        while (obj = obj.offsetParent);
    }
    return [curleft,curtop];
}
/*End White Label DropDown Menu Functions*/


/*for bug of IE6 when select fields are above the tooltips*/

function ShowMenu() {
document.getElementById("frTest").style.display = "inline"; 
}
function HideMenu() {
document.getElementById("frTest").style.display = "none"; 
}


//***************************************************//
//Flash Detect Functions

function checkFlash()
{
var rb_fver = "8";
var rb_flash = 0;
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ) {
 var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
 if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= rb_fver)
  rb_flash = 1;
 } else if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
 navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  rb_flash = 1;
}

    if (rb_flash)
        {
            return true;
        }
    else
        {
            return false;
        }
    
}

function setVisibility(flashshown, flashId, noflashId)
{
var flashdiv = document.getElementById(flashId);
var noflashdiv = document.getElementById(noflashId); 
if (flashdiv && noflashdiv)
            {            
            if (flashshown)
            {            
                flashdiv.style.display='';
                noflashdiv.style.display='none';                
            }
            else
            {
                flashdiv.style.display='none';
                noflashdiv.style.display='';                
            }
            }        
}
//***************************************************//


function showOverlay(boxwidth, boxHeight) {  
    el = document.getElementById("overlay");
    el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
    el.style.display = (el.style.display == "block") ? "none" : "block";

    el2 = document.getElementById("OverlayContent1");
    el2.style.visibility = (el2.style.visibility == "visible") ? "hidden" : "visible";
    el2.style.display = (el2.style.display == "block") ? "none" : "block";
    
    el3 = document.getElementById("OverlayContent");
    el3.style.visibility = (el3.style.visibility == "visible") ? "hidden" : "visible";
    el3.style.display = (el3.style.display == "block") ? "none" : "block";

    var myArray = new Array();
    myArray = getPageSizeWithScroll();


    el.style.height = myArray[1] + 'px'; 
    
    el2.style.left = ( ( myArray[0] / 2 ) -300 ) + "px";
    el3.style.left = ( ( myArray[0] / 2 ) -300 )+ "px";

    if (typeof document.body.style.maxHeight != "undefined") {
        // IE 7, mozilla, safari, opera 9
    } else {
        // IE6, older browsers
       el.style.width = myArray[0] + 'px';
       if (boxwidth > myArray[0])
       {
            el.style.width = boxwidth + 'px';
       }
    }

    if (boxwidth > myArray[0])
    {
        el.style.width = boxwidth + 'px';
    }
    if (boxHeight > myArray[1])
    {
        el.style.height = (boxHeight + 100) + 'px';
    }
    return false;
}

function getPageSizeWithScroll(){
    if (window.innerHeight && window.scrollMaxY)
    {
        // Firefox         
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
     }
     else if (document.body.scrollHeight > document.body.offsetHeight)
    { // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
        xWithScroll = document.body.scrollWidth;
    }
    else
    { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;
    }    
    arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
    //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
    return arrayPageSizeWithScroll;
} 

function ShowAusPopUp(dropDownID,dropDownValue,whatTheseContainer)
{
    var whatThese = document.getElementById(whatTheseContainer);
    var dropDown=document.getElementById(dropDownID);                           
    if (dropDown.value==dropDownValue)
    {
        whatThese.style.display='block';
    }
    else
    {
        whatThese.style.display='none';
    }
}