/* ***********************Begin drop down menu*********************** */
activateMenu = function(nav) {

    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){
    /* pass the function the id of the top level UL */
    /* remove one, when only using one menu */
    activateMenu('mainnavul'); 
}

/* ***********************end drop down menu*********************** */
/* ***********************begin popup window*********************** */
function openpopupWindow(url, name) {
  popupWin = window.open(url, name, 'width=360,height=280,left=20,top=20,resizable=0,scrollbars=0')
}
/* ***********************end popup window*********************** */
/* ***********************begin toggle div tags***********************  */

function togglevisibility() {
  var inc, endInc=arguments.length;
  for (inc=0; inc<endInc; inc+=2) {
    var id = arguments[inc];
    if (arguments[inc+1] == 'hidden') param = "hidden";
    else if(arguments[inc+1]=='visible') param = "visible";
    if (document.layers) document.layers['container'].layers[id].visibility = param;
    else if (document.all) eval("document.all." + id + ".style.visibility = \"" + param + "\"");
    else if (document.getElementById) eval("document.getElementById(id).style.visibility = \"" + param + "\"");
  }
}

/* ***********************end toggle div tags*********************** */
/* ***********************begin widget*********************** */
function expandcollapse (postid) { 

   whichpost = document.getElementById(postid); 
   
   if (whichpost.className=="postshown") { 
      whichpost.className="posthidden"; 
   } 
   else { 
      whichpost.className="postshown"; 
   } 
} 
/* ***********************end widget*********************** */

/* ***********************Begin siteurl*********************** */
var siteurl = '/';
// string to look for in the url
var keyword = 'devsite/';
// get the starting position of the string
var keywordPos = location.href.indexOf(keyword);
// gather everything in the url up to and including the keyword
if (keywordPos != -1) siteurl = location.href.substr(0, keywordPos+keyword.length);
/* ***********************end siteurl*********************** */

/* ***********************Begin Flash*********************** */
function activateFlash(swfURL) {
	if ( plugin ) {   
				var width = '777';
				var height = '294';
				var bgcolor = '#4A494A';
				var link1 = siteurl +'item_one/';
				var link2 = siteurl +'item_two/';
				var link3 = siteurl +'item_three/';
				document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" id="flash_ad" width="' + width + '" height="' + height + '">');
			 	document.write('<param name="movie" value="' + swfURL + '" />');
				document.write('<param name="quality" value="autohigh" />');
				document.write('<param name="menu" value="false" />');
				document.write('<param name="wmode" value="transparent" />');
				document.write('<param name="bgcolor" value="' + bgcolor + '" />');
				document.write('<param name=FlashVars value="learnURL=' + link1 + '&telcoURL=' + link2 + '&cableURL=' + link3 + '">');
			 	document.write('<embed src="' + swfURL + '" quality="autohigh" swLiveConnect="false" FlashVars="learnURL=' + link1 + '&telcoURL=' + link2 + '&cableURL=' + link3 + '" width="' + width + '" height="' + height + '"  wmode="transparent" bgcolor="' + bgcolor + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" menu="false"></embed>');
				document.write('</object>');
			}
			else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)){
				document.write('<img src="masthead.gif" alt="" border="0" />');
			}
}
/* ***********************End Flash*********************** */
/* ***********************Begin random *********************** */
function random_masts()
{};

var random_masts = new random_masts();

var number = 0;

random_masts[number++] = '<img src="' + siteurl + 'pics/masts/home_01.jpg" alt="Innovative Therapeutics for the Treatment of Serious Diseases and Conditions of the Eye" border="0" usemap="#mast" />'
random_masts[number++] = '<img src="' + siteurl + 'pics/masts/home_02.jpg" alt="Innovative Therapeutics for the Treatment of Serious Diseases and Conditions of the Eye" border="0" usemap="#mast" />'
var random_mastsnumber = Math.floor(Math.random() * number);
/* ***********************End random *********************** */

$(document).ready(function() {
	$('ul.layeredContent > li > a').hover(
		function(event) {
			$(this).parent().addClass('active');
		},
		function(event) {
			$(this).parent().removeClass('active');
		}
	).click(function(event) {
		return false; // prevent clicks
	});
});