function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



function openCenteredWindow(url, name, width, height, features) {

  if(screen.width){

	  var winl = (screen.width-width)/2;

	  var wint = (screen.height-height)/2;

  } else {

		winl = 0;

		wint =0;

  }

  if (winl < 0) winl = 0;

  if (wint < 0) wint = 0;

  var settings = 'height=' + height + ',';

  settings += 'width=' + width + ',';

  settings += 'top=' + wint + ',';

  settings += 'left=' + winl + ',';

  settings += features;

  win = window.open(url, name, settings);

  win.window.focus();

}



function openNewsPopup(id, context_path) {

	openCenteredWindow(context_path + '/popup.php?id=' + id, 'news_popup', 500, 465, 'scrollbars=yes, resizable=no')

}



function openChinesePopup(context_path) {

	openCenteredWindow(context_path + '/popup_chino.php', 'chinese_popup', 640, 700, 'scrollbars=no, resizable=no')

}

function view_image(image,offset,text){

	var main_text = document.getElementById(text);

 	var main_image = document.getElementById(image);

 	main_image.style.visibility = 'visible';

	main_image.src = images[offset].uri;

	

	var w = images[offset].width;

	var h = images[offset].height;

	var maxw,maxh,neww,newh,red;

	

	if(image == 'main_image')

	{

		maxw = 400;

		maxh = 400;

	}

	else

	{

		maxw = 90;

		maxh = 120;

	}

	

	if( w > maxw || h > maxh )

	{

		neww = maxw;

		newh = maxh;

		

		if( w > h )

		{

			red = maxw*100/w;

			newh = Math.round(h*red/100);

			

			if( newh > maxh )

			{

				red = maxh*100/newh;

				newh = maxh;

				neww = Math.round(neww*red/100);

			}

		}

		else

		{

			red = maxh*100/h;

			neww = Math.round(w*red/100);

			

			if( neww > maxw )

			{

				red = maxw*100/neww;

				neww = maxw;

				newh = Math.round(newh*red/100);

			}

		}

	}

	else{

		neww = w;

		newh = h;

	}

	

	main_image.width = neww;

	main_image.height = newh;

	

	main_text.innerHTML = images[offset].text;

}



function view_thumb_main(offset){

	var current = document.getElementById('image_offset').value;

	offset = (1 * offset ) + (1 * current);

	view_image('main_image', offset,'main_text');

}



function slide_right_bar(){

	var current = document.getElementById('image_offset').value;

	var i = 0;

	var gallery = ['mini_image_0','mini_image_1','mini_image_2','mini_image_3'];

	var textgallery = ['mini_text_0','mini_text_1','mini_text_2','mini_text_3'];

	while( i < 4) {

		view_image(gallery[i], (current * 1) + (1 * 1) + (i*1), textgallery[i]);

		i = i + 1;

	}

	document.getElementById('image_offset').value = (1 * document.getElementById('image_offset').value ) + (1 * 1);

}



function slide_left_bar(){

	var current = document.getElementById('image_offset').value;

	var i = 0;

	var gallery = ['mini_image_0','mini_image_1','mini_image_2','mini_image_3'];

	var textgallery = ['mini_text_0','mini_text_1','mini_text_2','mini_text_3'];

	while( i < 4) {

		view_image(gallery[i], (current * 1) - (1 * 1) + (i*1), textgallery[i]);

		i = i + 1;

	}

	document.getElementById('image_offset').value = (1 * document.getElementById('image_offset').value ) - (1 * 1);

}



function initialize_gallery(){

	 var gallery = ['mini_image_0','mini_image_1','mini_image_2','mini_image_3'];

	 var textgallery = ['mini_text_0','mini_text_1','mini_text_2','mini_text_3'];

	 //esconda la flechita back

	 var back_arrow = document.getElementById('back');

	 back_arrow.style.visibility = 'hidden';

	if(images.length < 4)

	{

		var next_arrow = document.getElementById('next');

		next_arrow.style.visibility = 'hidden';

	}

 	 i = 0;

 	 while( i < (images.length )) {

 	 	view_image(gallery[i], i,textgallery[i]);

		i= i + 1;

	

	}

}

function gallery_next(){

	var current = document.getElementById('image_offset').value;

	var next_arrow = document.getElementById('next');

	var back_arrow = document.getElementById('back');

	var off_mas_cinco = 1 * (1  * current +  1 * 5)

	//alert("current: "+ off_mas_cinco + " total: "+ images.length); 		

	if ( off_mas_cinco >= images.length )

	{

		next_arrow.style.visibility = 'hidden';

		

	//aca desabilitar la flechita esconde el div de la imagen

	}else{	

		next_arrow.style.visibility = 'visible';

		//slide_right_bar();

	}

	back_arrow.style.visibility = 'visible';

	slide_right_bar();

}

function gallery_back(){

	var current = document.getElementById('image_offset').value;

	var back_arrow = document.getElementById('back');

	var next_arrow = document.getElementById('next');

	if ( (current * 1)-1  <= 0 ){

		back_arrow.style.visibility = 'hidden';

		//aca desabilitar la flechita esconde el div de la imagen

	}else{

		back_arrow.style.visibility = 'visible';		

	}

	slide_left_bar();

	next_arrow.style.visibility = 'visible';				

}



function song(source)

{

	var src = document.getElementById(source).value;

	document.getElementById('music1').innerHTML="<embed type='application/x-mplayer2' id='music2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' src='"+src+"' name='MediaPlayer1' width='300' height='300' controltype='2' showcontrols='1' showstatusbar='1' AutoStart='true'></embed>";

}



/*

activateActiveX

---------------

Purpose:  Dynamically replace any elements that will be affected by the new security feature in IE6/IE7 that requires a user to click certain types of elements to activate them before use.



Usage:  Include this file at the end of your html document using the following...

	<script language="JScript" type="text/jscript" src="activateActiveX.js"></script>

	





Since this script is in response to a software patent lawsuit, I feel it necessary to state the following...	



License:

activateActiveX is Copyright (C) 2006 Jason Baker (therippa AT gmail.com). It is available as open source code from:

http://therippa.blogspot.com



This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.



This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details http://www.gnu.org/licenses/gpl.html

*/



//Determine browser, we only need this for Internet Explorer

if (navigator.appName == "Microsoft Internet Explorer") {

	

	//Array of elements to be replaced

	var arrElements = new Array(3);

	arrElements[0] = "object";

	arrElements[1] = "embed";

	arrElements[2] = "applet";



	

	//Loop over element types

	for (n = 0; n < arrElements.length; n++) {

	

		//set object for brevity

		replaceObj = document.getElementsByTagName(arrElements[n]);

		

		//loop over element objects returned

		for (i = 0; i < replaceObj.length; i++ ) {

		

			//set parent object for brevity

			parentObj = replaceObj[i].parentNode;

			

			//grab the html inside of the element before removing it from the DOM

			newHTML = parentObj.innerHTML;

			

			//remove element from the DOM

			parentObj.removeChild(replaceObj[i]);

			

			//stick the element right back in, but as a new object

			parentObj.innerHTML = newHTML;

		

		}

	}

}

	



//-------------------SWFOBJECT-------------------//



/**

 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/

 *

 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:

 * http://www.opensource.org/licenses/mit-license.php

 *

 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for

 *   legal reasons.

 */

if(typeof deconcept == "undefined") var deconcept = new Object();

if(typeof deconcept.util == "undefined") deconcept.util = new Object();

if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();

deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){

	if (!document.getElementById) { return; }

	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';

	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);

	this.params = new Object();

	this.variables = new Object();

	this.attributes = new Array();

	if(swf) { this.setAttribute('swf', swf); }

	if(id) { this.setAttribute('id', id); }

	if(w) { this.setAttribute('width', w); }

	if(h) { this.setAttribute('height', h); }

	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }

	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();

	if(c) { this.addParam('bgcolor', c); }

	var q = quality ? quality : 'high';

	this.addParam('quality', q);

	this.setAttribute('useExpressInstall', useExpressInstall);

	this.setAttribute('doExpressInstall', false);

	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;

	this.setAttribute('xiRedirectUrl', xir);

	this.setAttribute('redirectUrl', '');

	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }

}

deconcept.SWFObject.prototype = {

	setAttribute: function(name, value){

		this.attributes[name] = value;

	},

	getAttribute: function(name){

		return this.attributes[name];

	},

	addParam: function(name, value){

		this.params[name] = value;

	},

	getParams: function(){

		return this.params;

	},

	addVariable: function(name, value){

		this.variables[name] = value;

	},

	getVariable: function(name){

		return this.variables[name];

	},

	getVariables: function(){

		return this.variables;

	},

	getVariablePairs: function(){

		var variablePairs = new Array();

		var key;

		var variables = this.getVariables();

		for(key in variables){

			variablePairs.push(key +"="+ variables[key]);

		}

		return variablePairs;

	},

	getSWFHTML: function() {

		var swfNode = "";

		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture

			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }

			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';

			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';

			var params = this.getParams();

			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }

			var pairs = this.getVariablePairs().join("&");

			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }

			swfNode += '/>';

		} else { // PC IE

			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }

			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';

			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';

			var params = this.getParams();

			for(var key in params) {

			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';

			}

			var pairs = this.getVariablePairs().join("&");

			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}

			swfNode += "</object>";

		}

		return swfNode;

	},

	write: function(elementId){

		if(this.getAttribute('useExpressInstall')) {

			// check to see if we need to do an express install

			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);

			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {

				this.setAttribute('doExpressInstall', true);

				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));

				document.title = document.title.slice(0, 47) + " - Flash Player Installation";

				this.addVariable("MMdoctitle", document.title);

			}

		}

		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){

			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;

			n.innerHTML = this.getSWFHTML();

			return true;

		}else{

			if(this.getAttribute('redirectUrl') != "") {

				document.location.replace(this.getAttribute('redirectUrl'));

			}

		}

		return false;

	}

}



/* ---- detection functions ---- */

deconcept.SWFObjectUtil.getPlayerVersion = function(){

	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);

	if(navigator.plugins && navigator.mimeTypes.length){

		var x = navigator.plugins["Shockwave Flash"];

		if(x && x.description) {

			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));

		}

	}else{

		// do minor version lookup in IE, but avoid fp6 crashing issues

		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/

		try{

			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");

		}catch(e){

			try {

				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);

				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)

			} catch(e) {

				if (PlayerVersion.major == 6) {

					return PlayerVersion;

				}

			}

			try {

				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");

			} catch(e) {}

		}

		if (axo != null) {

			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));

		}

	}

	return PlayerVersion;

}

deconcept.PlayerVersion = function(arrVersion){

	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;

	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;

	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;

}

deconcept.PlayerVersion.prototype.versionIsValid = function(fv){

	if(this.major < fv.major) return false;

	if(this.major > fv.major) return true;

	if(this.minor < fv.minor) return false;

	if(this.minor > fv.minor) return true;

	if(this.rev < fv.rev) return false;

	return true;

}

/* ---- get value of query string param ---- */

deconcept.util = {

	getRequestParameter: function(param) {

		var q = document.location.search || document.location.hash;

		if(q) {

			var pairs = q.substring(1).split("&");

			for (var i=0; i < pairs.length; i++) {

				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {

					return pairs[i].substring((pairs[i].indexOf("=")+1));

				}

			}

		}

		return "";

	}

}

/* fix for video streaming bug */

deconcept.SWFObjectUtil.cleanupSWFs = function() {

	if (window.opera || !document.all) return;

	var objects = document.getElementsByTagName("OBJECT");

	for (var i=0; i < objects.length; i++) {

		objects[i].style.display = 'none';

		for (var x in objects[i]) {

			if (typeof objects[i][x] == 'function') {

				objects[i][x] = function(){};

			}

		}

	}

}

// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/

deconcept.SWFObjectUtil.prepUnload = function() {

	__flash_unloadHandler = function(){};

	__flash_savedUnloadHandler = function(){};

	if (typeof window.onunload == 'function') {

		var oldUnload = window.onunload;

		window.onunload = function() {

			deconcept.SWFObjectUtil.cleanupSWFs();

			oldUnload();

		}

	} else {

		window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;

	}

}

if (typeof window.onbeforeunload == 'function') {

	var oldBeforeUnload = window.onbeforeunload;

	window.onbeforeunload = function() {

		deconcept.SWFObjectUtil.prepUnload();

		oldBeforeUnload();

	}

} else {

	window.onbeforeunload = deconcept.SWFObjectUtil.prepUnload;

}

/* add Array.push if needed (ie5) */

if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}



/* add some aliases for ease of use/backwards compatibility */

var getQueryParamValue = deconcept.util.getRequestParameter;

var FlashObject = deconcept.SWFObject; // for legacy support

var SWFObject = deconcept.SWFObject;




		$(document).ready(function(){	
			$("#slider").easySlider({
				auto: true, 
					pause:			7000,
				prevId: 		'prevBtn',
			prevText: 		'Previous',
			nextId: 		'nextBtn',	
			nextText: 		'Next',
				controlsShow:	false,
				continuous: true,
					numeric: true,
							numericId: 		'controls'
			});
		});	
	

