function checkTarget(divName) {
    var holderDiv = document.getElementById(divName);
    if (!holderDiv)
        return;
         
    var allLeftA = holderDiv.getElementsByTagName('a');
    for (var i in allLeftA) {        
        if (allLeftA[i].target == '_blank'){
            allLeftA[i].onclick = newWinCareers;
        }
    }
}
    
function openFlashInformation(url) {
    //alert(url);
    //resize window according to content?
    //window.location.href = url;
    //alert('about to opens');
    openWin(url, 'des', 530, 600);
    //window.open(url, 'none', 'toobar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=800,height=600');
    //return false;
}

//*******New style for window open for FF
//onclick="window.open('newpage.html', '_blank', 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes'); 
function newWin() {
    var dims = getDims(800, 1200);
    window.open(this, 'career', 'scrollbars=yes,width=' + dims['width'] + ',height=' + dims['height'])
    return false;
}

function newWinCareers(href, name) {
    var height = '700';
    //alert(this.href);
    //alert(href);
    var destination = this;
    var winName = 'career';
    if (!this.href)
        destination = href
        
    if (name)
        winName = name;
     
//    if (this.href && this.href.toLowerCase().indexOf('resume') != -1)
//        height = 400;
    //
    var win = window.open(destination, winName, 'left=100px,toolbar=yes,location=yes,resizable=yes,menubar=yes,scrollbars=yes,width=830,height=' + height);
    //if already a window with the same name, this will bring it focus
    win.focus();
    return false;
}

function openLocal(city) {
    var href = './Local.aspx?city=' + city;
    window.open(href, 'LocalDirections', 'toobar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=625');
    return false;
}

function getDims(maxWidth, maxHeight) {
    var winWidth = '600';
    var winHeight = '600';
    var dims = new Array()
    
    try {
      if( typeof( window.innerWidth ) == 'number' ) {
        winWidth = window.innerWidth;
        winHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        winWidth = document.documentElement.clientWidth;
        winHeight = document.documentElement.clientHeight;
        }
    }
    catch (e) {
        
    }
    
    if (maxWidth && winWidth > maxWidth) {
        winWidth = maxWidth;
    }
    
    if (maxHeight && winHeight > maxHeight) {
        winHeight = maxHeight;
    }
    
    dims['width'] = winWidth;
    dims['height'] = winHeight;
    
    return dims;

}
//Open the window with the google map in it with the same dimensions as the current window giving people with 
//big screens a big map and ppl with small screens a......
function openMap(href) {
    var dims = getDims();
    window.open(href, 'LocalMap', 'toobar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + dims['width'] + ',height=' + dims['height']);
    return false;
}
   
function openFlashWin(url, width, height) {
	openWin(url, 'Flash', width, height);
}

function openWin(url, winName, width, height, left) {
    if (!left)
        left = ''
    else
        left = ',left=' + left;
    window.open(url, winName, 'toobar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height + left);
}
