var url = window.location.href;

function getValue(variable)
{
	var variable_pos = url.indexOf(variable);

	if (variable_pos != -1)
	{
		var pos_separador = url.indexOf("&", variable_pos);

		if (pos_separador != -1)
			return url.substring(variable_pos + variable.length + 1, pos_separador);
		else
			return url.substring(variable_pos + variable.length + 1, url.length);
	}
	else
		return "";
}

function loadMovie(name, width, height, _partner, _url, _tittle)
{
	var remplaza = /\+/gi;

	url = unescape(url);
	url = url.replace(remplaza, " ");

	document.write('<div id="flashcontent"');
	document.write('</div>');

	var so = new SWFObject(name, "base", width, height, "8", "#999999", null, null, null, "error/noflash");
	so.addParam("allowFullScreen", "true");

	if (navigator.userAgent.indexOf("Opera")!=-1) (language=navigator.language)
	else if (navigator.appName == "Netscape") (language=navigator.language)
	else language=navigator.browserLanguage

	if (language){language=language.substring(0,2)}
	else language = "es";

	so.addVariable("gLanguage", language);
	so.addVariable("gUserName", getValue("userName"));
	so.addVariable("gPasswd", getValue("passwd"));
	so.addVariable("gPartner", _partner);
	so.addVariable("gFavTitle", _tittle);
	so.addVariable("gFavUrl", _url);
	so.write("flashcontent");
}


function foot(partner)
{

	document.write('<font color="#444444" size="-2" face="Arial, Helvetica, sans-serif">');
	
	document.write('OPQA - Juegos OnLine Multijugador. Todos los contenidos de este sitio web son propiedad de OPQA Studios © 2003-2012 - Todos los derechos reservados.');
	
	document.write('<br>');
//	document.write('<br>');
/*
	document.write('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fopqa.juegos&amp;layout=standard&amp;show_faces=false&amp;width=550&amp;action=like&amp;font&amp;colorscheme=light&amp;height=30" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:550px; height:30px;" allowTransparency="true"></iframe>');
*/

	if (partner == 'ECOM')
	{
		document.write('<br>');
		
		document.write('<a href="http://www.opqa.com/foro/" target="_blank">FORO</a> - ');
		document.write('<a href="http://opqa.spreadshirt.net" target="_blank">SHOPQA</a> - ');
		document.write('<a href="politica/politica.htm" target="_blank" onClick="window.open(this.href,this.target,\'width=580,height=400,scrollbars=1\'); return false;">Política de Privacidad</a> - ');
		document.write('<a href="politica/condiciones.htm" target="_blank" onClick="window.open(this.href, this.target,\'width=580,height=400,scrollbars=1\'); return false;">Condiciones Generales</a> - ');
		document.write('<a href="mailto:webmaster@opqa.com">Contactar</a> - ');
		document.write('<a href="mailto:publicidad@opqa.com">Publicidad</a>');
		
		document.write('<br>');
		
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=3OnLine">3OnLine</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=4OnLine">4OnLine</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=ajedrez">Ajedrez</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=pintamonas">Pintamonas</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=parchis">Parchís</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=alfanumericos">Alfanuméricos</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=domino">Dominó</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=mas2">Más2</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=billare/">Billares</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=cruzaletras">Cruzaletras</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=escoba">Escoba</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=musete">Musete</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=chinchon">Chinchón</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=oca">Oca</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=bingo">Bingo</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=eruditos">Eruditos</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=tute">Tute</a> - ');
		document.write('<a href="http://www.opqa.com/ecomm.html?juego=poker">Poker</a>');
		
		document.write('<br><br>');
		document.write('</font>');
		
		return;
	}
	
		document.write('<br>');
		
		document.write('<a href="http://www.opqa.com/foro/" target="_blank">FORO</a> - ');
		document.write('<a href="http://opqa.spreadshirt.net" target="_blank">SHOPQA</a> - ');
		document.write('<a href="http://www.opqa.com/politica/politica.htm" target="_blank" onClick="window.open(this.href,this.target,\'width=580,height=400,scrollbars=1\'); return false;">Política de Privacidad</a> - ');
		document.write('<a href="http://www.opqa.com/politica/condiciones.htm" target="_blank" onClick="window.open(this.href, this.target,\'width=580,height=400,scrollbars=1\'); return false;">Condiciones Generales</a> - ');
		document.write('<a href="mailto:webmaster@opqa.com">Contactar</a> - ');
		document.write('<a href="mailto:publicidad@opqa.com">Publicidad</a>');
		
		document.write('<br>');
		
		document.write('<a href="http://www.opqa.com/juegos/3OnLine/">3OnLine</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/4OnLine/">4OnLine</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/ajedrez/">Ajedrez</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/pintamonas/">Pintamonas</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/parchis/">Parchís</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/alfanumericos/">Alfanuméricos</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/domino/">Dominó</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/mas2/">Más2</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/billares/">Billares</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/cruzaletras/">Cruzaletras</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/escoba/">Escoba</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/musete/">Musete</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/chinchon/">Chinchón</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/oca/">Oca</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/bingo/">Bingo</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/eruditos/">Eruditos</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/tute/">Tute</a> - ');
		document.write('<a href="http://www.opqa.com/juegos/poker/">Poker</a>');
		
		document.write('<br><br>');
		document.write('</font>');
}

function bottomR()
{
	document.write('<iframe name=afi728x90' + 
	' src="http://www.netfilia.com/contenidos/insert.html?cmf=83701&con_capa=1&contenido=728x90&web=37337&p=459858919&id=hiZW/bXZ6/7sk&url='+escape(location.href)+'"' + 
	' width=728 height=90 frameBorder=no border=0 marginWidth=0 marginHeight=0 scrolling=no style="border-style:none;" >' + 
	'</iframe>');
}

function topC()
{
	document.write('<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fopqa.juegos&amp;layout=standard&amp;show_faces=false&amp;width=550&amp;action=like&amp;font&amp;colorscheme=light&amp;height=30" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:550px; height:30px;" allowTransparency="true"></iframe>');

	document.write('<br>');
}

function topR()
{
	document.write('<iframe name=afi120x90' + 
	' src="http://www.netfilia.com/contenidos/insert.html?cmf=84223&con_capa=1&contenido=120x90&web=37337&p=552669715&id=hik/m.FS0bNFk&url='+escape(location.href)+'"' + 
	' width=120 height=90 frameBorder=no border=0 marginWidth=0 marginHeight=0 scrolling=no style="border-style:none;" >' + 
	'</iframe>');
}

function bottomL()
{
	document.write('<iframe name=afi234x60' + 
	' src="http://www.netfilia.com/contenidos/insert.html?cmf=84109&con_capa=1&contenido=234x60&web=37337&p=193419367&id=hiVXEA2w3WVgA&url='+escape(location.href)+'"' + 
	' width=234 height=60 frameBorder=no border=0 marginWidth=0 marginHeight=0 scrolling=no style="border-style:none;" >' + 
	'</iframe>');
}

function topL()
{
	// TopL 728x90
	document.write('<iframe name=afi728x90' + 
	' src="http://www.netfilia.com/contenidos/insert.html?cmf=83998&con_capa=1&contenido=728x90&web=37337&p=1636983004&id=hiZW/bXZ6/7sk&url='+escape(location.href)+'"' + 
	' width=728 height=90 frameBorder=no border=0 marginWidth=0 marginHeight=0 scrolling=no style="border-style:none;" >' + 
	'</iframe>');
}

function miniScreen(swf, width, height, url, partner, tittle)
{
	document.write('<table width="100%" height="100%" align="center" valign="middle"><tr><td>');
		document.write('<table border="0" cellspacing="0" cellpadding="0" align="center"><tr><td align="center">');
			document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td>');
			document.write('</td></tr></table>');
		document.write('</td></tr><tr><td height="15">');
		document.write('</td></tr><tr><td align="center">');
				loadMovie(swf, width, height);
		document.write('</td></tr><tr><td align="center">');
				foot(partner);
		document.write('</td></tr><tr><td height="15">');
		document.write('</td></tr><tr><td align="center">');
				document.write('<table border="0" cellspacing="0" cellpadding="0"><tr><td>');
				document.write('</td></tr></table>');
		document.write('</td></tr>');
	document.write('</td></tr></table>');
		document.write('</table>');
}

function normalScreen(swf, width, height, partner, url, tittle)
{

	document.write('<table width="100%" height="100%" align="center" valign="middle"><tr><td>');
		document.write('<table border="0" cellspacing="0" cellpadding="0" align="center"><tr><td align="center">');
			document.write('</td></tr><tr><td align="center">');
			topC();
		document.write('</td></tr></table>');
		document.write('<table border="0" cellspacing="0" cellpadding="0" align="center"><tr><td align="center">');
			document.write('</td></tr><tr><td align="center">');
			loadMovie(swf, width, height, partner, url, tittle)
		document.write('</td></tr></table>');
		document.write('<table border="0" cellspacing="0" cellpadding="0" align="center"><tr><td align="center">');
			document.write('</td></tr><tr><td align="center">');
			foot(partner);
		document.write('</td></tr></table>');
	document.write('</table>');
}

