/** 
  * ======================================================
  * $Workfile:   2-6_script.js  $
  * $Revision:   1.0  $
  * $Date:   Apr 30 2009 10:47:38  $
  * $Author:   goddarmx  $
  * $Archive:   //renpdbsmhprod02/pvcsdata/Development_Area/archives/LargeLaw/PageDesigner/v4/Code/Front-end/_Source/LexisNexis/Website/Modules/Style/Themes/2-6/2-6_script.js-arc  $
  * ======================================================
  * Change History:
  * 1.00 initial revision
**/

// bookmark functionality
function bookmark(url, title){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url, title);
	} else if (navigator.appName == "Netscape") {
		window.sidebar.addPanel(title, url, "");
	} else {
	    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}

//  this shows and hides the language selector
function showLanguage() {
	//	show the list
	$('ul.ulLanguages').removeClass('hidden');	
	//	append a close link
	if(!$('li#closeLink')) {
		$('<li id="closeLink"><a href="#" title="Close Language Menu">Close</a></li>').filter('#closeLink a').click(function() {
			hideLanguage();
		}).appendTo('ul.ulLanguages');}
	}
function showLanguage() {
/*	// first thing is to hide the options
	$('ul.ulLanguages').addClass('hidden');
	$('.divLanguages h2 a').click(function () {
		showLanguage();
	});
*/
    var d = document.getElementsByTagName('div');
    for(i=0;i<d.length;i++) {
        var a = d[i].className;
        if(a == 'divLanguages') {
            var l = d[i].getElementsByTagName('ul');
            for(x=0;x<l.length;x++) {
                var c = l[x].className;
                if(c == 'ulLanguages') {
                    l[x].className = 'openLanguage';
                    //  create new list item and link then append to list
                    var n = document.createElement('li');
                    n.setAttribute('id','closeLink');
                    var na = document.createElement('a');
                    na.setAttribute('href','javascript:showLanguage();');
                    na.innerHTML = 'Close';
                    n.appendChild(na);
                    l[x].appendChild(n);
                } else {
                    l[x].className = 'ulLanguages';
                    var e = l[x].lastChild;
                    l[x].removeChild(e);
                }
            }
        }
    }
}

function resizeHeaderCell() {
	
	if($('div#headerImgHolder img').length == 0) {
		$('td#col1').addClass('closeCell');
		$('td#col2').addClass('resizeCell');
	}
}

function resizeVideo() {
	$('object').css({width:'220px',height:'178px'});
	$('embed').css({width:'220px',height:'178px'});
}

function roundCorners() {
	//	language/bookmark area pod
	$('td#col01 div.overFlow').prepend('<div class="divPodTop"></div>');
	$('td#col01 div.overFlow').append('<div class="divPodBtm"></div>');
	
    //	contact info pod
	$('td#col02 div.divContact').wrapInner('<div class="divPodInner"></div>');
	$('td#col02 div.divContact').prepend('<div class="divPodTop"></div>');
	$('td#col02 div.divContact').append('<div class="divPodBtm"></div>');
	$('td#col02 div.divAddress').wrapInner('<div class="divPodInner"></div>');
	$('td#col02 div.divAddress').prepend('<div class="divPodTop"></div>');
	$('td#col02 div.divAddress').append('<div class="divPodBtm"></div>');
	
	//	left column pods
	//	navigation pod
	var divNav = document.createElement('div');
	divNav.id = 'divNav';
	$('div#column01 ul#nav').wrap(divNav);
	$('div#divNav').prepend('<div class="divPodTop">');
	$('div#divNav').append('<div class="divPodBtm">');
	
	//	all widget pods
	$('div#column01 div.divPod').prepend('<div class="divPodTop"></div>');
	$('div#column01 div.divPod').append('<div class="divPodBtm"></div>');
	
	// column 02 container
	$('div#column02').wrapInner('<div class="innerContent">');
	$('div#column02').prepend('<div class="divPodTop"></div>');
	$('div#column02').append('<div class="divPodBtm"></div>');
	
	//	divPodContainer divPods	
	$('div.divPodContainer div.divPod').prepend('<div class="divPodTop"></div>');
	$('div.divPodContainer div.divPod').append('<div class="divPodBtm"></div>');
}

function zebraStripes() {
	//	adds alternating background colors to the pod containers within home page
	$("div.divPodContainer div.divPod:odd").addClass("odd");
}

jQuery().ready(function(){
	/*	start rounded corners	*/
	roundCorners();
	zebraStripes();
/*
	// init accordion left nav
	$('#nav').accordion({
		active: '.active',
		header: 'li.closed > a',
		event: 'mouseover',
		animated: 'easeslide',
		autoheight: false
	});
	
	$('#nav li.active > a').prepend('> ');
*/	
	//resizeVideo();
	//resizeHeaderCell();
});