/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var url = "http://" + window.location.hostname;
var urlImg = url  + "/Img/";
if(url.toLowerCase().indexOf("localhost") > 0)
{
    var urlImg = url  + "/Bersin/Img/";
}
function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function getInternetExplorerVersion() {
    var rv = -1; // Return value assumes failure.
    if (navigator.appName == 'Microsoft Internet Explorer') {
        var ua = navigator.userAgent;
        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat(RegExp.$1);
    }
    return rv;
}

function overlaymenu(curobj, subobjstr, opt_position, e){
if(typeof document.onclick=='function')
document.onclick(e);
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
document.onclick=function(e){
clicktohide(curobj, subobjstr, e)
}
if(subobj.style.display!="block")
{
subobj.style.display="block";
}
else 
{
overlayclose(subobjstr);
}
//subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)

var browser=navigator.appName;
var IEversion=getInternetExplorerVersion();
if(browser == 'Netscape' && curobj.id == 'blogPageShareId'){  
   ypos = ypos+17;
}
if(browser == 'Microsoft Internet Explorer' && IEversion >7 && curobj.id == 'blogPageShareId'){
   xpos =xpos+120;
   ypos = ypos+17;
}
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none";
//resetGnavSearchBtn();
}

function clicktohide(linkobj, subobj, e){
if(!e && (!window.event||!window.event.srcElement))
return;
var currentnode=(window.event)? event.srcElement : e.target
var hidesubobj=true
while (currentnode.tagName!="BODY" && currentnode.tagName!="HTML"){
if (currentnode.id==subobj || currentnode==linkobj){
hidesubobj=false
break
}
currentnode=currentnode.parentNode
}
if (hidesubobj)
    { 
    overlayclose(subobj);
    }
}

function overlay(curobj, subobjstr, opt_position, edit){
if (document.getElementById){
var subobj=document.getElementById(subobjstr);
subobj.style.display=(subobj.style.display!="block")? "block" : "none"

var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)

if(edit == true)
{
    subobj.style.left=xpos-255+"px"
    subobj.style.top=ypos-222+"px"
}
else
{
    subobj.style.left=xpos+"px"
    subobj.style.top=ypos+"px"
}
    
return false
}
else
return true
}

function changeGnavSearchBtn(fieldName, newBg)
{
  var myField = document.getElementById(fieldName);
  //var myClass = myField.className;
  //myField.className = newClass;
  //myField.style.backgroundImage = "url(" + urlImg + newBg + ")";
}

function resetGnavSearchBtn()
{
  var myField = document.getElementById('gnavSearch');
  //myField.style.backgroundImage = "url(" + urlImg + "BgBtn5aOffNew.gif" + ")";
  return true;
}
