/* Initialize
------------------------------------------------*/

var menuMarker = 'home';
var prodMarker = 'Home';
var images = [];

var xmlfiles = [];


/* DOM Loaded
------------------------------------------------*/

var mainSWF;

$(document).ready(function(){
	
	init();
	
	
 				   
});

function init() 
{
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1, sPath.lastIndexOf('.'));
	var idioma=$("#id_idioma").val();
	
	var urld="";
	
	
	
	if(idioma==""){
		urld="pageitems/master/categorypages/automotive/assets/xml/index.xml"
	}else{
		urld="pageitems/master/categorypages/automotive/assets/xml/index_"+idioma+".xml"
	}
	
	/*urld="pageitems/master/categorypages/automotive/assets/xml/index.xml"*/
	
	
	$.ajax({
		type: "GET",
		url: urld,
		dataType: ($.browser.msie) ? "text" : "xml",
		success: function(xml) {
			var newXML = parseXml(xml);		
			$(newXML).find('text').each(function() {
				var id = $(this).attr("name");
				$("#"+id).html($(this).text());
			});
			
			
			
			
			

			cambiarSeccion('home');

		},
		error:function (xhr, ajaxOptions, thrownError){ 
			alert(xhr.status);
			alert(thrownError);
		} 						
	});
	
	$(".imgVacia").attr("src","pageitems/master/categorypages/automotive/assets/images/empty.gif");
	$(".imgSeparadorMenu").attr("src","pageitems/master/categorypages/automotive/assets/images/separadorbotonera.png");
	
	
	
}



function cambiarSeccion(marker) 
{
	
	//tag philips omniture...
	//s.pageName = _page.metrics.getMetaData().division + ":" + _page.metrics.getMetaData().section + ":" + (_page.metrics.getMetaData().productsubcategory || _page.metrics.getMetaData().productcategory) + ":" + marker.toLowerCase() + ":" + _page.metrics.getMetaData().catalogtype;
	
	s.t();
	
	$('#tab'+menuMarker).css("display", "none");
	$("#div"+menuMarker).css("background-image", "url(pageitems/master/categorypages/automotive/assets/images/empty.png)");	
	menuMarker = marker;
	
	
	$("#div"+menuMarker).css("background-image", "url(pageitems/master/categorypages/automotive/assets/images/home/rollover.png)");
	$("#div"+menuMarker).css("background-repeat", "no-repeat");
	$("#div"+menuMarker).css("text-align", "center");
	$('#tab'+menuMarker).css("display", "block");	
	
	if (marker == "home")
	{
		
	
		
	}
	


	
}


function parseXml(xml) {  
	if (jQuery.browser.msie) {  
		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");   
		xmlDoc.loadXML(xml);  
		xml = xmlDoc;  
	}  
	return xml;  
} 

/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/


 
function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}


