


/* LUKY.COM - All Code Below Is Copyrighted.
   Copyright (c)2006 Todd Roseman. All Rights Reserved.
   Do not use without prior permission.
*/
function relativeFilePart( s )	{
	var i;
	
	var rsl = /\\/g;
	s = s.replace(rsl,'/');
	var re = /\/dw\/(.*)/;
	var rg = re.exec(s);
	if (rg)	{
		if (rg.length<=1)	{
			rr = /\/.com\/(.*)/;
			rg = rr.exec(s);
			if (rg.length<=1) { return s; }
		}
		return rg[1];
	}
	else { return s; }
}


function setCurrentPage() {
	var navEl = document.getElementById("lnav");
	var aEls = navEl.getElementsByTagName("A");
	var i, as, thisFile, liEl, liEj, liElast;
	var currentFile;
	
	currentFile = relativeFilePart(document.URL);

	// find this page and set it's <li> to different class, also set parents li (if exists)
	for (var i=0; i<aEls.length; i++) {
		// className
		as = new String(aEls[i].href);
		thisFile = relativeFilePart(as);
//		alert(thisFile + " " + as);
		// thisFile = as.substring(as.lastIndexOf('/')+1,100);
		// alert( thisFile + currentFile + (thisFile==currentFile));
		if (thisFile == currentFile)	{
			// break; // do all occurances of this file in menu
			
			// set this element
			// set top-level parent (this menu, immediate parent, (not ul though)
			liEl = aEls[i];
			liEl.className = liEl.className + " here";
			// also set parent (li)
			liEj = liEl.parentNode;
			liEj.className = liEj.className + " here";
			
		}
	}
}


function postLoad()	{

	if (window.attachEvent) {	// ie only
		sfHover();
	}
	setCurrentPage();

	// ShowNotice();
	// this shows the notice box on all pages

//	var doc = new String(document.URL);
	// alert(doc.length + ": " + doc.substring(doc.length-1));
//	if ((doc.indexOf("index.htm") != -1) || (doc.substring(doc.length-1)=="/"))	{
//		ShowNotice();
//	}
}

var newWin;
function largeImg(source)	{
	var s;
	s = "largeimg.htm?src="+escape(source);

	newWin = window.open(s,"newWin","resizable=yes,menubar=no,titlebar=yes,dependent=yes,width=100,height=100");
	newWin.focus();
	return false;
}


if (document.getElementById){ 
	document.write('<style type="text/css">\n');
	document.write('.pagesection {display: none;}\n');
	document.write('</style>\n');
}



function SwitchOver(obj,submenu)	{
	SwitchTab(obj);
	SwitchTabContent(submenu);
}

function SwitchTab(obj)	{
	if(document.getElementById){
		var el = document.getElementById(obj);
		var arid = document.getElementById("tabrow");
		if (arid)	{
			var ar = arid.getElementsByTagName("a");
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="tabOn")
					ar[i].className = "tab";
			}
			el.className = "tabOn";
		}
	}
}

function SwitchTabContent(obj){
	if(document.getElementById){
		var el = document.getElementById(obj);
		var arid = document.getElementById("tabcontent");
		if (arid)	{
			var ar = arid.getElementsByTagName("div");
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="tabsubmenu")
					ar[i].style.display = "none";
			}
			el.style.display = "block";
		}
	}
}


function StartMenu()	{
	SwitchOver("tab1","sub1");
}

/* used for collapsible page sections */
function SwitchMenu(obj){
	if (document.getElementById) {
		var el = document.getElementById(obj);
		var ar = document.getElementById("allpagesections").getElementsByTagName("div"); 
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="pagesection") //DynamicDrive.com change
					ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}


var gNoticeInterval=null;

function ShowNotice()	{
	var bAlreadyShown = false;
	var dc = document.cookie;
	var el;
	var rg;
	var elbody;
	var s;
	
	// NOTE: cannot do this before page loads, must do at end of page or in PostLoad
	if (dc.indexOf("noticebox2") != -1) { bAlreadyShown = true; }
	if (!bAlreadyShown)	{
		//var el = document.getElementById("noticebox");
		// create a DIV element, using the variable eDIV as a reference to it
		el = document.createElement("div");
		//use the setAttribute method to assign it an id
		el.setAttribute("id","noticebox");
		el.innerHTML
		s = "<p>this is a notice box</p>";
		s += '<p align="center"><a onClick="NoticeOff()" href="#">Close Notice</a></p>';
		el.innerHTML = s;
		elbody = document.getElementsByTagName('body')[0];
		elbody.appendChild(el);
		//alert("here");
		//el.style.display = "block";
		
		// NOTYET - set cookie to not display again for this session
		gNoticeInterval = setInterval(noticeTimeout,1*60*1000);
	}	
}

function noticeTimeout()	{
	clearInterval(gNoticeInterval);
	NoticeOff();
}

function NoticeOff()	{
	var el = document.getElementById("noticebox");
	if (el)	{
		el.style.display = "none";
	}
	//document.cookie="noticebox2=1";
	return false;
}


function GenVideo( css_id, videopath ) {
   // need to release last flash before it will allow replacing
   // NOTE: this DOES NOT work if id passed to swfobject 2nd param is same as css id! seems to keep obj around and not allow replacement, works in ie, not firefox, just make different and it's ok   
	var so = new SWFObject("vid-1c.swf", css_id+"notused", "320", "260", "7", "");
	so.addParam("loop", "false");
	so.addParam("play", "true");
	so.addParam("wmode", "transparent");
	so.addVariable("file",videopath);
	so.write(css_id);
}
function GenAudio( css_id, audiopath ) {
   //var el = document.getElementById(css_id);
   //if (el) { el.innerHTML = '&nbsp;'; }
   var so = new SWFObject("fullmp3player.swf", css_id+"notused", "290", "24", "7", "");
   so.addParam("loop", "false");
   so.addParam("wmode", "transparent");
   so.addVariable("soundFile",audiopath);
   so.write(css_id);
}

function GenMedia( css_id, videopath, audiopath ) {

}


