/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	ADxMenu.js - v4 (4.10)
	www.aplus.co.yu/adxmenu/
	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	(c) Copyright 2003, Aleksandar Vacic, www.aplus.co.yu
		This work is licensed under the Creative Commons Attribution License.
		To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/ or
		send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
function ADxMenu_IESetup() {
	var aTmp2, i, j, oLI, aUL, aA;
	var aTmp = xGetElementsByClassName("adxm", document, "ul");
	for (i=0;i<aTmp.length;i++) {
		aTmp2 = aTmp[i].getElementsByTagName("li");
		for (j=0;j<aTmp2.length;j++) {
			oLI = aTmp2[j];
			aUL = oLI.getElementsByTagName("ul");
			//	if item has submenu, then make the item hoverable
			if (aUL && aUL.length) {
				oLI.UL = aUL[0];	//	direct submenu
				aA = oLI.getElementsByTagName("a");
				if (aA && aA.length)
					oLI.A = aA[0];	//	direct child link
				//	li:hover
				oLI.onmouseenter = function() {
					this.className += " adxmhover";
					this.UL.className += " adxmhoverUL";
					if (this.A) this.A.className += " adxmhoverA";
					if (WCH) WCH.Apply( this.UL, this, true );
				};
				//	li:blur
				oLI.onmouseleave = function() {
					this.className = this.className.replace(/adxmhover/,"");
					this.UL.className = this.UL.className.replace(/adxmhoverUL/,"");
					if (this.A) this.A.className = this.A.className.replace(/adxmhoverA/,"");
					if (WCH) WCH.Discard( this.UL, this );
				};
			}
		}	//for-li.submenu
	}	//for-ul.adxm
}

//	adds support for WCH. if you need WCH, then load WCH.js BEFORE this file
if (typeof(WCH) == "undefined") WCH = null;

/*	xGetElementsByClassName()
	Returns an array of elements which are
	descendants of parentEle and have tagName and clsName.
	If parentEle is null or not present, document will be used.
	if tagName is null or not present, "*" will be used.
	credits: Mike Foster, cross-browser.com.
*/
function xGetElementsByClassName(clsName, parentEle, tagName) {
	var elements = null;
	var found = new Array();
	var re = new RegExp('\\b'+clsName+'\\b');
	if (!parentEle) parentEle = document;
	if (!tagName) tagName = '*';
	if (parentEle.getElementsByTagName) {elements = parentEle.getElementsByTagName(tagName);}
	else if (document.all) {elements = document.all.tags(tagName);}
	if (elements) {
		for (var i = 0; i < elements.length; ++i) {
			if (elements[i].className.search(re) != -1) {
				found[found.length] = elements[i];
			}
		}
	}
	return found;
}

/*	allows instant "window.onload" (DOM.onload) function execution. shortened version, just IE code
	credits: Dean Edwards/Matthias Miller/John Resig/Rob Chenny
	http://www.cherny.com/webdev/27/domloaded-updated-again
*/
var DomLoaded = {
	onload: [],
	loaded: function() {
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis) {
		this.onload.push(fireThis);
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
		    if (this.readyState == "complete") {
		        DomLoaded.loaded();
		    }
		};
		/*@end @*/
	}
};

function big_init()
{
	self.y_center=(parseInt(screen.height/2));
	self.x_center=(parseInt(screen.width/2));
	self.pop_stack=Array();
}

function get_center(size, side)
{
	center = eval('self.'+side+'_center-('+size+'/2);');
	return(parseInt(center));
}

function close_pop(pop_name)
{
	eval ('pop_'+pop_name+'.close()');
}

function build_pop(url, pop_name, pop_width, pop_height, pop_left, pop_top, pop_status, pop_resizable, pop_directories, pop_toolbar, pop_scrollbars, pop_reload)
{
	if (typeof(pop_width) == 'string'){	pop_width=parseInt((pop_width.substr(0, pop_width.indexOf('P')-1))*(screen.width/10));	} 
	if (pop_width<100) { alert('ancho invalido: '+pop_width); pop_width=100; }
	
	if (typeof(pop_height) == 'string'){ pop_height=parseInt((pop_height.substr(0, pop_height.indexOf('P')-1))*(screen.height/10)); }
	if (pop_height<100) { alert('alto invalido: '+pop_height); pop_height=100; }
	
	if (!pop_left){ pop_left=get_center(pop_width,'x');	}
	if (!pop_top){ pop_top=get_center(pop_height,'y'); }

	window_opts = 'width='+pop_width+',height='+pop_height+',left='+pop_left+',top='+pop_top;
	if (pop_status!=1) { window_opts+= ',status=no'; } else { window_opts+= ',status=yes'; }
	if (pop_resizable!=1) { window_opts+= ',resizable=no'; } else { window_opts+= ',resizable=yes';}
	if (pop_directories!=1) { window_opts+= ',directories=no'; } else { window_opts+= ',directories=yes'; }
	if (pop_toolbar!=1) { window_opts+= ',toolbar=no'; } else { window_opts+= ',toolbar=yes'; }
	if (pop_scrollbars==0) {
		window_opts+= ',scrollbars=no';
	} else if (pop_scrollbars==1) {
		window_opts+= ',scrollbars=yes';
	} else {
		window_opts+= ',scrollbars=auto';
	}
   eval('self.pop_it=1;\n'+
   		'if (self.pop_'+pop_name+' && !pop_'+pop_name+'.closed) {\n'+
			'self.pop_it=0;\n'+
			'if (pop_reload){\n'+
				'if (pop_reload==\'R\') {\n'+
					'pop_'+pop_name+'.reload();\n'+
				'} else if(pop_reload==\'C\') {\n'+
					'pop_'+pop_name+'.close();\n'+
					'self.pop_it=1;\n'+
				'} else {\n'+
					'pop_'+pop_name+'.location="'+url+'";\n'+
				'}\n'+
			'}\n'+
		'}'+
		'if (self.pop_it==1) {\n'+
			'pop_'+pop_name+' = window.open ("'+url+'", "pop_'+pop_name+'", "'+window_opts+'");\n'+
			'var set_stack=true;\n'+
		'}\n'+
		'pop_'+pop_name+'.focus();');
	
}

function PaintMenu( )
{
document.write('<li><a href="http://www.dralexmarketing.com/moodle/login/logout.php">Log Out</a></li>' +
'<li><a href="#">My Account&nbsp;<img alt="V" src="/style/arrow.gif" height="7" width="7" /></a>' +
'	<ul>' +
'      <li><strong>General</strong></li>' +
'	<li><a href="http://www.dralexmarketing.com/amember/members/umc/commercial-bonuses.php">Commercial Bonuses</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/amember/member.php">My Account Info</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/forums/profile.php?do=editprofile" target="_blank">My Profile</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/forums/usercp.php" target="_blank">My Forums Control Panel</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/forums/private.php">My Private Messages</a></li>' +
'      <li><strong>Partners</strong></li>' +
'	<li><a href="http://www.dralexmarketing.com/moodle/mod/resource/view.php?id=135">Members-Only Affiliate Program</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/affiliate/affiliates/" target="_blank">My Affiliate Control Panel</a></li>' +
'      <li><strong>Support / Feedback</strong></li>' +
'   <li><a href="http://www.dralexmarketing.com/forums/sendmessage.php">Contact Us</a></li>' +
'	</ul>' +
'</li>' +
'<li><a href="#">Resources&nbsp;<img alt="V" src="/style/arrow.gif" height="7" width="7" /></a>' +
'	<ul>' +
'   <li><strong>Terminology</strong></li>' +
'	<li><a href="javascript:build_pop(\'/amember/members/pt00/Penelope2/Penelope2.html\', \'Media\',660,564,10,10,\'0\',\'0\',\'0\',\'0\',\'0\',\'1\');">What is PR?</a></li>' +
'	<li><a href="javascript:build_pop(\'/amember/members/pt00/Terry2/Terry2.html\', \'Media\',660,564,10,10,\'0\',\'0\',\'0\',\'0\',\'0\',\'1\');">What is Salient Marketing?</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/moodle/mod/glossary/view.php?id=136">Global Glossary</a></li>' +
'   <li><strong>Creating your website</strong></li>' +
'	<li><a href="http://www.dralexmarketing.com/msm/members/web_resources.php">Web Resources</a></li>' +
'   <li><strong>Creating your products</strong></li>' +
'	<li><a href="http://www.dralexmarketing.com/amember/members/umc/MegaLibrary.php" target="_blank">Mega Library of Digital Resources</a></li>' +
'	</ul>' +
'</li>' +
'  <li><a href="#">Tools <img alt="V" src="/style/arrow.gif" height="7" width="7" /></a>' +
'    <ul>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/research/research.php">Research Lab</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/web_tools.php">Web Tools</a></li>' +
'	<li><a href="http://www.dralexmarketing.com/msm/members/">Offline/Stand-alone Tools</a></li>' +
'    </ul>' +
'  </li>' +
'  <li><a href="#">Forums <img alt="V" src="/style/arrow.gif" height="7" width="7" /></a>' +
'    <ul>' +
'      <li><a href="http://www.dralexmarketing.com/forums/" target="_blank">Forums Index</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/forums/forumdisplay.php?f=17" target="_blank">Main UMC Forum</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/forums/search.php?do=getdaily" target="_blank">Today\'s Posts</a></li>' +
'    </ul>' +
'  </li>' +
'  <li><a href="#">Challenge&nbsp;<img alt="V" src="/style/arrow.gif" height="7" width="7" /></a>' +
'    <ul>' +
'      <li><strong>Getting Started</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/getting_started.php">Introduction</a></li>' +
'      <li><strong>Foundations</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step01.php"> 1: Business mindset</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step02.php"> 2: Customer Value Survey</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step03.php"> 3: Research Analysis</a></li>' +
'      <li><strong>Branding</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step04.php"> 4: Brand Salience</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=10"> 5: Strategic Marketing</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=12"> 6: PR Approach</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=11"> 7: CRISSE Total Marketing</a></li>' +
'      <li><strong>Your Website</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=17"> 8: Your dream website</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step09.php"> 9: Email Marketing</a></li>' +
'      <li><strong>Launch</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=16">10: Marketing Materials</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step11.php">11: Pre-launch</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/amember/members/umc/step12.php">12: Lift-off, evaluation & review</a></li>' +
'      <li><strong>Bonus</strong></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=3">13: Copywriting</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=4">14: Copywriting Workshop</a></li>' +
'      <li><a href="http://www.dralexmarketing.com/moodle/course/view.php?id=5">15: Tips by Experts</a></li>' +
'    </ul>' +
'  </li>' +
'  <li><a href="http://www.dralexmarketing.com/moodle/">Home</a></li>' +
'</ul><br />' 
);
}

//	load the setup function
DomLoaded.load(ADxMenu_IESetup);

