function opma()
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="600" height="426" id="OPMA-intro" align="middle">')
	document.write('<param name="allowScriptAccess" value="sameDomain" />')
	document.write('<param name="movie" value="OPMA-intro.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<param name="bgcolor" value="#ffffff" />')
	document.write('<embed src="OPMA-intro.swf" quality="high" bgcolor="#ffffff" width="600" height="426" name="OPMA-intro" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	document.write('</object>')
}

function menu()
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="204" height="374" id="OPMA-intro" align="middle">')
	document.write('<param name="allowScriptAccess" value="sameDomain" />')
	document.write('<param name="movie" value="OPMA-menu.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<param name="bgcolor" value="#ffffff" />')
	document.write('<embed src="OPMA-menu.swf" quality="high" bgcolor="#ffffff" width="204" height="374" name="OPMA-intro" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	document.write('</object>')
}

function thumbs()
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="325" height="80" id="OPMA-intro" align="middle">')
	document.write('<param name="allowScriptAccess" value="sameDomain" />')
	document.write('<param name="movie" value="thumbs.swf" />')
	document.write('<param name="quality" value="high" />')
	document.write('<param name="bgcolor" value="#ffffff" />')
	document.write('<embed src="thumbs.swf" quality="high" bgcolor="#ffffff" width="325" height="80" name="OPMA-intro" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />')
	document.write('</object>')
}

function openNewWindow(theUrl) 
{ 
	window.open(theUrl, 'P', 'width=550,height=550,toolbar=no,status=no,menubar=no,scrollbars=yes,top=10,left=10'); 

}

function openNewWindow2(theUrl) 
{ 
	window.open(theUrl, 'P', 'width=550,height=630,toolbar=no,status=no,menubar=no,scrollbars=yes,top=10,left=10'); 

}

function movepic(img_name,img_src) {
document[img_name].src=img_src;
}


function changeHref(href)
{
	var ns6 = (!document.all && document.getElementById);
	var ie4 = (document.all);
	
	if (ns6)
		window.top.document.getElementById('print').href=href;
	
	else if (ie4)
		window.top.document.all.print.href=href;
}

function isset(variable_name) {
    try {
         if (typeof(eval(variable_name)) != 'undefined')
         if (eval(variable_name) != null)
         return true;
     } catch(e) { }
    return false;
   }

function cargarPaginaCompleta(contenido) {
	try {
	   if ( !isset(parent.dhtmlHistory)) {
		location.href="http://www.opma-assn.com/webs/cont.php#"+contenido;
		}
	}
	catch (exception) {
		location.href="http://www.opma-assn.com/webs/cont.php#"+contenido;
	}
}


//Gestión del div de banners
var oXMLHttpRequest;
var HTMLloading = '<Br><br><br><br><div align=center valign=middle width=355 height=255><img src="http://www.opma-assn.com/gfx/loading.gif" width="32" height="32"><br><font face=arial color=#777777 size=2>loading...</font></div>';
var g_currentSection='home'; //mantiene el valor de la sección actual para no recargar el contenido si es el mismo
var g_currentSlide='home';
var g_currentTitulo='home';

function iniciarRequest()
{
	var miXMLHttpRequest;
	if(window.XMLHttpRequest) //		window.status = "Mozilla";
	{
		miXMLHttpRequest = new XMLHttpRequest();
	}
	else if(window.ActiveXObject) //		window.status = "IE";
	{
		miXMLHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return miXMLHttpRequest;
}

//INI - changeBannerSection
function dochangeBannerSection(Section) {
	if (g_currentSection != Section)
	{
		g_currentSection = Section;
		document.getElementById("divSeccionBanners").innerHTML = '<IFRAME SRC="banners.php?Section='+Section+'" TITLE="OPMA" name="bannerSection" SCROLLING="no" width="770" height="200" frameborder="0" marginwidth="0" marginheight="0"></IFRAME>';
	}
}

//FIN - changeBannerSection

//INI - changeSlideSection
function dochangeSlideSection(Section) {
	var titulo;

	if (g_currentSlide != Section)
	{
		g_currentSlide = Section;

		if (Section == "about") {titulo = 'about.htm';}
		else if (Section == "membership") {titulo = 'membership.htm';}
		else if (Section == "news") {titulo = 'news.htm';}	
		else if (Section == "gimme5") {titulo = 'gimme5.htm';}
		else if (Section == "eatingwell") {titulo = 'eatingwell.htm';}
		else if (Section  == "sitemap")	{titulo = 'home.htm';}
		else if (Section == "search") {titulo = 'home.htm';}
		else {titulo = 'home.htm';}

		document.getElementById("divSlide").innerHTML = '<IFRAME SRC="slides/'+titulo+'" TITLE="OPMA" name="Slides" SCROLLING="no" width="211" height="374" frameborder="0" marginwidth="0" marginheight="0"></IFRAME>';
	}
}
//FIN - changeSlideSection


//INI - dochangeTitulo
function dochangeTitulo(Section) {
	var titulo;

	if (g_currentTitulo != Section)
	{
		g_currentTitulo = Section;
		if (Section == "about") {titulo = 'tit-about.gif';}
		else if (Section == "membership") {titulo = 'tit-membership.gif';}
		else if (Section == "news") {titulo = 'tit-news.gif';}	
		else if (Section == "gimme5") {titulo = 'tit-gimme5.gif';}
		else if (Section == "eatingwell") {titulo = 'tit-eatingwell.gif';}
		else if (Section  == "sitemap")	{titulo = 'tit-sitemap.gif';}
		else if (Section == "search") {titulo = 'tit-search.gif';}
		else {titulo = 'tit-home.gif';}

		if (titulo=="tit-home.gif") document.getElementById("divTitulo").innerHTML = '<table cellpadding=0 cellspacing=0 border=0 width=492><tr><td align=left><img name="tit" src="../gfx/tit-home.gif" width="280" height="45" alt="About The OPMA" title="About The OPMA"></td><td align=right><input type=button onclick="javascript:openNewWindow(\'../onlineforms/membership-member1.htm\')" style=\'background-image:url("../gfx/joinnow.jpg");width:81px;height:25px\' onmouseover=\'this.style.cursor="pointer"\' onfocus=this.blur()></tr></table>';
		else document.getElementById("divTitulo").innerHTML = '<img name="tit" src="../gfx/'+titulo+'" width="559" height="45" alt="About The OPMA" title="About The OPMA">';			
	}
}
//FIN - dochangeTitulo


function dochangeContenido(contenido, Section, _slideTo) {
    setTimeout('changeContenido("'+contenido+'", "'+Section+'", "'+_slideTo+'")', 0);
}


var g_requestContenido;

function changeContenido(contenido, Section, _slideTo)
{
	g_requestContenido = iniciarRequest();
	g_requestContenido.onreadystatechange = processRequestContenido;
	var url;
	if (_slideTo>0)
	{
		url = "../webs/cont.php?accion=divContenido&contenido="+contenido+"&slideTo="+_slideTo;
	}
	else
	{
		url = "../webs/cont.php?accion=divContenido&contenido="+contenido;
	}
	g_requestContenido.open("GET",url);
	g_requestContenido.send(null);


	if (Section=='')
	{
		if	((contenido == "about-whatwedo") || (contenido == "about-oursponsors") || (contenido == "about-contactus"))	
		{Section="about";}

		else if ((contenido == "membership-joiningtheopma") || (contenido == "membership-industryservices") ||
		         (contenido == "membership-promotingyourbusiness")	|| (contenido == "login") || (contenido=="membership-memberlogin") ||
				 (contenido == "membership-jobpostings"))
		{Section="membership";}

		else if ((contenido == "news-currentevents") || (contenido == "news-golftournament")	|| (contenido == "news-curling")
		         (contenido == "news-galaevent") || (contenido == "news-consumershows"))	
		{Section="news";}

		else if ((contenido == "gimme5-gimme5kids") || (contenido == "gimme5-fruitandveggiefun") ||
		         (contenido == "gimme5-promoting5to10aday") || (contenido == "gimme5-freggie"))
		{Section="gimme5";}

		else if ((contenido == "eatingwell-weeklyrecipe") || (contenido == "eatingwell-nutritionalinformation"))	
		{Section="eatingwell";}

		else if (contenido == "sitemap")	{Section="sitemap";}
		else if (contenido == "search")	{Section="search";}
		else	{Section="home";}

	}


	dochangeTitulo(Section);	
	dochangeBannerSection(Section);
	dochangeSlideSection(Section);

	if ((_slideTo>0) && (g_currentSection != Section))
	{
		document.getElementById("divMenu").innerHTML = '<IFRAME SRC="menu.htm" TITLE="OPMA" name="menu" SCROLLING="no" width="204" height=374 frameborder="0" marginwidth="0" marginheight="0"></IFRAME>'; 
	}
}


function processRequestContenido()
{
	if(g_requestContenido.readyState < 4)
	{
			document.getElementById("divContenido").style.display="none";
			document.getElementById("divContenido").innerHTML = HTMLloading; 
			document.getElementById("divContenido").style.display="";
	}

	if(g_requestContenido.readyState == 4)
	{
		if(g_requestContenido.status == 200)
		{
			document.getElementById("divContenido").style.display="none";
			document.getElementById("divContenido").innerHTML = g_requestContenido.responseText;
			document.getElementById("divContenido").style.display="";
		}
	}
}





var g_requestMember;

function dochangeMemberSection(op, iduser) {
    setTimeout('changeMemberSection("'+op+'", "'+iduser+'")', 0);
}

function changeMemberSection(op, iduser)
{
	g_requestMember = iniciarRequest();
	g_requestMember.onreadystatechange = processRequestMemberSection;
	var url = "../webs/cont.php?accion=divMember&contenido="+op+"&gIdusuario="+iduser;
	g_requestMember.open("GET",url);
	g_requestMember.send(null);
}


function processRequestMemberSection()
{
	if(g_requestMember.readyState == 4)
	{
		if (g_requestMember.status == 200)
		{
			window.top.document.getElementById("divMember").style.display="none";
			window.top.document.getElementById("divMember").innerHTML = g_requestMember.responseText;
			window.top.document.getElementById("divMember").style.display="";
		}
	}
}


function logear() {
	var ns6 = (!document.all && document.getElementById);
	var ie4 = (document.all);
	alert('login');
	if (ie4) {document.parent.changeContenido('login&login='+document.s.login.value+'&pass='+document.s.pass.value);} 
	else {	  window.top.document.changeContenido('login&login='+document.s.login.value+'&pass='+document.s.pass.value);}
}


