
function setimg(who,what)
{
	
	document.getElementById(who).src = "images/" + what;
	
	
}

function startrotation()
{
	//alert("Calling");
	setInterval("nextadd()",5000);

	
}



function nextadd()
{
	
	
	
	jQuery("#main_add1").animate({opacity: 'toggle'},350);
	
	setTimeout('changeBG()', 350);
	jQuery("#main_add1").animate({opacity: 'toggle'},350);
	
	
	
}

function changeBG()
{

var num 	= document.getElementById('current_add').value;
var maxadds = document.getElementById('total_adds').value;

if(num == maxadds)
{

	num = 1;
	
	
}else{
	
	
	num++;	
	
}

document.getElementById('current_add').value = num;

document.getElementById('main_add1').style.background = "url(images/main_add"+num+".jpg) no-repeat";	
	
}

function pastadd()
{
	
	jQuery("#main_add1").animate({opacity: 'toggle'},350);
	
	setTimeout('changeBG2()', 350);
	jQuery("#main_add1").animate({opacity: 'toggle'},350);
	
	
}

function changeBG2()
{

var num 	= document.getElementById('current_add').value;
var maxadds = document.getElementById('total_adds').value;

if(num == 1)
{

	num = maxadds;
	
	
}else{
	
	
	num--;	
	
}

document.getElementById('current_add').value = num;

document.getElementById('main_add1').style.background = "url(images/main_add"+num+".jpg) no-repeat";	
	
}


function gotoproduct(estilo,color)
{
	
	window.location = "prod"+estilo+color+".html";
	//window.location = "proximamente.html";
	
}

function gotoaddpage()
{
	
	var num 	= document.getElementById('current_add').value;
	
	if(num == 1)
	{
	
		window.location = "productos.html";
		
	}else{
		
	
		window.location = "promociones.html";
		
	}
	
	
	
}



