/***********************************************
* AnyLink Drop Down Menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

//Contents for menu 1
//var home_menu=new Array()
//home_menu[0]='<a href="http://www.javascriptkit.com">news & interviews</a>'
//home_menu[1]='<a href="http://www.freewarejava.com">videos</a>'
//home_menu[2]='<a href="http://codingforums.com">new music</a>'
//home_menu[3]='<a href="http://www.cssdrive.com">community</a>'

var video_menu=new Array()
//video_menu[0]='<a href="http://www.javascriptkit.com">news & interviews</a>'
//video_menu[1]='<a href="http://www.freewarejava.com">videos</a>'
//video_menu[2]='<a href="http://codingforums.com">new music</a>'
//video_menu[3]='<a href="http://www.cssdrive.com">community</a>'

    // Sridhar : added condition to fix relative url issue for BET Internal servers.
    // add the internal server name to the array below
    var serverList = ['172.20.20.24', 'betcma01', 'betcma01.web.bet.com' ,'172.20.20.64', 'betapp01', 'mcms.web.bet.com', '172.20.20.55' , 'stage.bet.com' ,
                      'betdevimage01' ,'localhost' , '127.0.0.1'];
    var IsInternalServer = false;

    for (i=0; i<serverList.length; i++)
    {
        // test if the host server is internal or public.
        if(location.host == serverList[i] )
         IsInternalServer = true;
    }
    //condition to test whether the server is internal or public
    if(IsInternalServer)
    {
        //Contents for menu 2, and so on
        var music_menu=new Array()
        music_menu[0]='<a href="/www.bet.com/music">music main</a>'
        music_menu[1]='<a href="/www.bet.com/music/news">news</a>'
        music_menu[2]='<a href="/www.bet.com/music/newmusic">new music</a>'
        music_menu[3]='<a href="/www.bet.com/music/videos">videos</a>'
        music_menu[4]='<a href="/www.bet.com/music/photos">photos</a>'
        music_menu[5]='<a href="/www.bet.com/music/blogs">blogs</a>'
        //music_menu[6]='<a href="/www.bet.com/music/features">features</a>'

        var ontv_menu=new Array()
        ontv_menu[0]='<a href="/www.bet.com/OnTV">on tv main</a>'
        ontv_menu[1]='<a href="/www.bet.com/OnTV/BETshows">bet shows</a>'
        ontv_menu[2]='<a href="/www.bet.com/OnTV/BETJShows/">betj shows</a>'
        ontv_menu[3]='<a href="/www.bet.com/OnTV/Specials">specials</a>'
        ontv_menu[4]='<a href="/www.bet.com/OnTV/Schedule">schedule</a>'
        //ontv_menu[5]='<a href="/www.bet.com/OnTV/CastingCall">casting call</a>'
        		
        var news_menu=new Array()
        news_menu[0]='<a href="/www.bet.com/News">news main</a>'
        news_menu[1]='<a href="/www.bet.com/News/Blogs">blogs</a>'
        news_menu[2]='<a href="/www.bet.com/News/Decision08">be heard</a>'
        news_menu[3]='<a href="/www.bet.com/News/Features">features</a>'
        news_menu[4]='<a href="/www.bet.com/News/Photos">photos</a>'
        //news_menu[5]='<a href="/www.bet.com/News/Sports">sports</a>'

        var entertainment_menu=new Array()
        entertainment_menu[0]='<a href="/www.bet.com/entertainment">entertainment main</a>'
        entertainment_menu[1]='<a href="/www.bet.com/entertainment/blogs">blogs</a>'        
        entertainment_menu[2]='<a href="/www.bet.com/entertainment/dvd">dvd</a>'
        entertainment_menu[3]='<a href="/www.bet.com/entertainment/movies">movies</a>'
        entertainment_menu[4]='<a href="/www.bet.com/entertainment/news">news</a>'
        entertainment_menu[5]='<a href="/www.bet.com/entertainment/photos">photos</a>'
        entertainment_menu[6]='<a href="/www.bet.com/entertainment/tv">tv</a>'
        //entertainment_menu[2]='<a href="/www.bet.com/entertainment/comedy">comedy</a>'

        var lifestyle_menu=new Array()
        lifestyle_menu[0]='<a href="/www.bet.com/lifestyle">lifestyle main</a>'
        lifestyle_menu[1]='<a href="/www.bet.com/lifestyle/blogs">blogs</a>'
        lifestyle_menu[2]='<a href="/www.bet.com/lifestyle/bodysoul">body & soul</a>'
        lifestyle_menu[3]='<a href="/www.bet.com/lifestyle/careers">careers</a>'
        lifestyle_menu[4]='<a href="/www.bet.com/lifestyle/photos">photos</a>'
        lifestyle_menu[5]='<a href="/www.bet.com/lifestyle/style">style</a>'

        //var health_menu=new Array()
        //health_menu[0]='<a href="http://cnn.com">CNN</a>'
        //health_menu[1]='<a href="http://msnbc.com">MSNBC</a>'
        //health_menu[2]='<a href="http://news.bbc.co.uk">BBC News</a>'



        var community_menu=new Array()
        community_menu[0]='<a href="/www.bet.com/community">community main</a>'
        //community_menu[1]='<a href="http://www.bet.com/community/community_bgirls.htm">b-girls</a>'
        community_menu[1]='<a href="http://betboards.bet.com/">boards</a>'
        community_menu[2]='<a href="http://mobile.bet.com">mobile</a>'
        community_menu[3]='<a href="http://shine.bet.com">shine</a>'
        community_menu[4]='<a href="http://yaheard.bet.com">ya heard</a>'
		
    }
	else
	{
		//Contents for menu 2, and so on
        var music_menu=new Array()
        music_menu[0]='<a href="http://www.bet.com/music">music main</a>'
        music_menu[1]='<a href="http://www.bet.com/music/news">news</a>'
        music_menu[2]='<a href="http://www.bet.com/music/newmusic">new music</a>'
        music_menu[3]='<a href="http://www.bet.com/music/photos">photos</a>'
        music_menu[4]='<a href="http://www.bet.com/music/videos">videos</a>'
        music_menu[5]='<a href="http://www.bet.com/music/blogs">blogs</a>'
        //music_menu[6]='<a href="http://www.bet.com/music/features">features</a>'


        var ontv_menu=new Array()
        ontv_menu[0]='<a href="http://www.bet.com/OnTV">on tv main</a>'
        ontv_menu[1]='<a href="http://www.bet.com/OnTV/BETshows">bet shows</a>'
        ontv_menu[2]='<a href="http://www.bet.com/OnTV/BETJShows/">betj shows</a>'
        ontv_menu[3]='<a href="http://www.bet.com/OnTV/Specials">specials</a>'
        ontv_menu[4]='<a href="http://www.bet.com/OnTV/Schedule">schedule</a>'
        //ontv_menu[5]='<a href="http://www.bet.com/OnTV/CastingCall">casting call</a>'
        		
        var news_menu=new Array()
        news_menu[0]='<a href="http://www.bet.com/News">news main</a>'
        news_menu[1]='<a href="http://www.bet.com/News/Blogs">blogs</a>'
        news_menu[2]='<a href="http://www.bet.com/News/Decision08">be heard</a>'
        news_menu[3]='<a href="http://www.bet.com/News/Features">features</a>'
        news_menu[4]='<a href="http://www.bet.com/News/Photos">photos</a>'
        //news_menu[5]='<a href="http://www.bet.com/News/Sports">sports</a>'

        var entertainment_menu=new Array()
        entertainment_menu[0]='<a href="http://www.bet.com/entertainment">entertainment main</a>'
        entertainment_menu[1]='<a href="http://www.bet.com/entertainment/blogs">blogs</a>'        
        entertainment_menu[2]='<a href="http://www.bet.com/entertainment/dvd">dvd</a>'
        entertainment_menu[3]='<a href="http://www.bet.com/entertainment/movies">movies</a>'
        entertainment_menu[4]='<a href="http://www.bet.com/entertainment/news">news</a>'
        entertainment_menu[5]='<a href="http://www.bet.com/entertainment/photos">photos</a>'
        entertainment_menu[6]='<a href="http://www.bet.com/entertainment/tv">tv</a>'
        //entertainment_menu[2]='<a href="http://www.bet.com/entertainment/comedy">comedy</a>'

        var lifestyle_menu=new Array()
        lifestyle_menu[0]='<a href="http://www.bet.com/lifestyle">lifestyle main</a>'
        lifestyle_menu[1]='<a href="http://www.bet.com/lifestyle/blogs">blogs</a>'
        lifestyle_menu[2]='<a href="http://www.bet.com/lifestyle/bodysoul">body & soul</a>'
        lifestyle_menu[3]='<a href="http://www.bet.com/lifestyle/careers">careers</a>'
        lifestyle_menu[4]='<a href="http://www.bet.com/lifestyle/photos">photos</a>'
        lifestyle_menu[5]='<a href="http://www.bet.com/lifestyle/style">style</a>'

        //var health_menu=new Array()
        //health_menu[0]='<a href="http://cnn.com">CNN</a>'
        //health_menu[1]='<a href="http://msnbc.com">MSNBC</a>'
        //health_menu[2]='<a href="http://news.bbc.co.uk">BBC News</a>'



        var community_menu=new Array()
        community_menu[0]='<a href="http://www.bet.com/community">community main</a>'
        //community_menu[1]='<a href="http://www.bet.com/community/community_bgirls.htm">b-girls</a>'
        community_menu[1]='<a href="http://betboards.bet.com/">boards</a>'
        community_menu[2]='<a href="http://mobile.bet.com">mobile</a>'
        community_menu[3]='<a href="http://shine.bet.com">shine</a>'
        community_menu[4]='<a href="http://yaheard.bet.com">ya heard</a>'
	}		
	
var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?


/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;z-index:1999999;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if(menucontents == null || menucontents.length == 0) return;
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

// unhighlight the old selected tab if existant
if(dropmenuobj._currentTabObj != null){
	if(removeClass){
		removeClass(dropmenuobj._currentTabObj, "primaryNavigationHover");
	}
}
// highlight the tab
if(addClass){	// make sure the function is available
	addClass(obj, "primaryNavigationHover");
}
// set the new selected tab
dropmenuobj._currentTabObj = obj;

if (ie4||ns6){
//I put this zindex stuff here. Might not be the best place. I could put it up above.
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
	if (typeof dropmenuobj!="undefined"){
		if (ie4||ns6){
			dropmenuobj.style.visibility="hidden";
		}
		if(dropmenuobj._currentTabObj != null){
			if(removeClass){
				removeClass(dropmenuobj._currentTabObj, "primaryNavigationHover");
			}
		}
	}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu
