// JavaScript Document

atheme = new Array();
aproperties = new Array();
acss = new Array();
efectBox = new Array();	
tema_Actual = 99;
iniProperties();
//iniTheme();
function iniProperties(){
	acss[0] = '#contentS';
	acss[1] = '#contenidoIntMns';
	acss[2] = '#contenidoIntMnb';
	acss[3] = '.mntop a:hover';
	acss[4] = '.linkrecd a:hover';
	acss[5] = '.formInput';
	acss[6] = '.regUser';
	acss[7] = '.cont_btnList .btn_List';
	aproperties[0] = 'color';
	aproperties[1] = 'backgroundImage';	//
	aproperties[2] = 'backgroundColor';	//
	aproperties[3] = 'borderColor';	
	
	setefect(0,'100px','0px','122px','0px','.rsn');
	setefect(1,'100px','0px','-122px','0px','.rsn');
	setefect(2,'0px','0px','122px','318px','.rsn_2');
}
function iniTheme(image,value)
{
	if(value == 0)
		setTheme(0,'url(../image/home/'+image+')','url(../image/util/bg_menu_0s.png)','url(../image/util/bg_menu_0b.png)','#748694','#748694','#839DAD');
	else if(value == 1)
		setTheme(1,'url(../image/home/'+image+')','url(../image/util/bg_menu_1s.png)','url(../image/util/bg_menu_1b.png)','#A24BBA','#AA79CE','#9871CC');
	else if(value == 2)
		setTheme(2,'url(../image/home/'+image+')','url(../image/util/bg_menu_2s.png)','url(../image/util/bg_menu_2b.png)','#A24BBA','#C66CB8','#D3ABC4');
	else
		setTheme(0,'url(../image/home/bg_bdInt.png)','url(../image/util/bg_menu_0s.png)','url(../image/util/bg_menu_0b.png)','#748694','#748694','#839DAD');
	/*setTheme(0,'url(../image/util/bg_0.png)','url(../image/util/bg_menu_0s.png)','url(../image/util/bg_menu_0b.png)','#FF0000','#748694','#748694','#839DAD');
	setTheme(1,'url(../image/util/bg_1.png)','url(../image/util/bg_menu_1s.png)','url(../image/util/bg_menu_1b.png)','#333333','#A24BBA','#AA79CE','#9871CC');
	setTheme(2,'url(../image/util/bg_2.png)','url(../image/util/bg_menu_2s.png)','url(../image/util/bg_menu_2b.png)','#000000','#A24BBA','#C66CB8','#D3ABC4');*/
	getTheme(value);
	//setEfectBox();
}
function setTheme(nameTheme,nmBgH,nmBgMns,nmBgMnb,cBgForm,cBorderInput,cUserList){
	arrayproperties = new Array();
	arrayproperties[0] = nameTheme;
	arrayproperties[1] = nmBgH;
	arrayproperties[2] = nmBgMns;
	arrayproperties[3] = nmBgMnb;
	//arrayproperties[4] = cLinkHv;
	arrayproperties[5] = cBgForm;
	arrayproperties[6] = cBorderInput;
	arrayproperties[7] = cUserList;
	atheme[nameTheme] = arrayproperties;
	
}
function getTheme(nrandom){
	
	if(tema_Actual == 99){
		//var nrandom = Math.floor(Math.random()*3);
		var tempArray = new Array();		
	}else{
		nrandom = tema_Actual;
	}
	
	tempArray = atheme[nrandom];
	var j=0;
	
	buscarPropiedad(acss[0],aproperties[1],tempArray[1]);
	buscarPropiedad(acss[1],aproperties[1],tempArray[2]);
	buscarPropiedad(acss[2],aproperties[1],tempArray[3]);
	buscarPropiedad(acss[3],aproperties[0],tempArray[4]);
	buscarPropiedad(acss[4],aproperties[0],tempArray[4]);
	buscarPropiedad(acss[5],aproperties[1],tempArray[2]);
	buscarPropiedad(acss[5],aproperties[2],tempArray[5]);
	buscarPropiedad(acss[5],aproperties[3],tempArray[6]);
	buscarPropiedad(acss[6],aproperties[1],tempArray[2]);
	buscarPropiedad(acss[7],aproperties[2],tempArray[7]);
}

function buscarPropiedad(selector,propi,value)
{
	//alert("Selector "+selector +" Propi "+propi+" Value "+value);
  if (document.all)
	miRegla = document.styleSheets[0].rules;
  else
	miRegla = document.styleSheets[0].cssRules;	
	for (i=0; reg=miRegla[i]; i++)
	{
		if (reg.selectorText.toLowerCase() == selector.toLowerCase())
		{
			reg.style[propi] = value;
		}
	}
}


function setefect(rand,top,left,top1,left1,box){
	aryprop = new Array();
	aryprop[0] = rand;
	aryprop[1] = top;
	aryprop[2] = left;
	aryprop[3] = top1;
	aryprop[4] = left1;
	aryprop[5] = box;
	efectBox[rand] = aryprop;
}
var isExplorer = (document.all ? true : false);
function getNavSize(){	
	var xScroll, yScroll;	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { 
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}			
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	obj = document.getElementById('contenidoInt');
	var err = 19;
	if(isExplorer){
		obj.style.minHeight = '610px';
	}
	else{
		obj.style.minHeight = '585px';
	}
	obj.style.height = (windowHeight-195+err)+'px';195
	if(document.all){
		obj2 = document.getElementById('contentS');
		obj2.style.width = '99.9%';
	}
	
	//alert(arrayPageSize);
	//return arrayPageSize;	
}

