var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
var isIE = false /*@cc_on || @_jscript_version != 0 @*/;
var aPath = window.location.pathname.split("/");

function changeLocation(location) {
	var path = aPath;
	var file = path.pop();
	
	// Remove country code
	if (path[path.length-1].length==2) path.pop();
	
	switch (location){
		case 'es':
			path.push(location);
		default:
			file = (file && file!="index.html")?file:"";
			window.location.href = path.join("/") + "/" + file;
	}
}

var fixTablesIE6 = function() {
	if (!IE6) return;
	
	var tables = document.getElementsByTagName("table");
	var language = (aPath[aPath.length-2]=="es")?"../":"";
	
	for (var i = 0, len=tables.length; i<len; i++) {
		if (tables[i].className=="download_block") {
			var tds = tables[i].getElementsByTagName("td");
			
			// Head
			tds[0].style['background']= 'transparent url('+language+'images/table_up_left.gif) no-repeat top left';
			tds[1].style['background']= 'transparent url('+language+'images/table_up_center.gif) repeat-x top left';
			tds[2].style['background']= 'transparent url('+language+'images/table_up_center.gif) repeat-x top left';
			tds[3].style['background']= 'transparent url('+language+'images/table_up_right.gif) no-repeat top right';
			
			// Sides
			tds[4].style['background']= 'transparent url('+language+'images/table_middle_left.gif) repeat-y top';
			tds[5].style['background']= 'none';
			tds[6].style['background']= 'none';
			tds[7].style['background']= 'transparent url('+language+'images/table_middle_right.gif) repeat-y top';
			
			
		}
		
	}
}

window.onload = function () {
	if (!isIE) {
		document.body.style['overflow'] = 'scroll';
		return;
	}
	if (!IE6) return;
	fixTablesIE6();
	var headPadding = "0 15px";
	var headTabPadding = "0";
	
	var divs = document.getElementsByTagName("div");
	
	// Fix index
	var file = aPath[aPath.length-1];
	if (file=="" || file=="index.html") {
		document.getElementById("foot").style['padding']= "0 60px";
		document.getElementById("all").style['width']= 760+90;
	    document.getElementById("divleft").style['padding']= "0 0 0 35px";
	    headPadding = "0 60px";
		
    }
	for (var i = 0, len=divs.length; i<len; i++) {
		var node = divs[i];
	    if (node.className=="cabecera") {
	       node.style['padding']= headPadding;
	       var lis = node.getElementsByTagName('a');
	       for (var j=0, len=lis.length; j<len; j++){
	         lis[j].style['padding']= headTabPadding;
	       }
	    }
	}
};

