function get_seccion (){
	return $('meta[name=seccion]').attr("content");
}
function addArticles(cant,section){
	
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else{
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById("articles").innerHTML = "";
			document.getElementById("articles").innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET","php/addArticle.php?section="+section+"&cant="+cant,true);
	xmlhttp.send();
}

$(document).ready(function() {	
	
	$("#btn-home").click(function () { 
		window.location.href = "?s=home";
	});
	$("#btn-home").mouseover(function () {
		$(this).css({"background-position":"200px 0px","cursor":"pointer"});
	});
	$("#btn-home").mouseout(function () {
		$(this).css({"background-position":"0px 0px","cursor":"default"});
	});
	
	//BTN products
	
	//BTN skate
	$("#btn-skate").click(function () { 
		window.location.href = "?s=skate";
	});
	$("#btn-skate").mouseover(function () {
		$(this).css({"background-position":"200px -60px","cursor":"pointer"});
	});
	$("#btn-skate").mouseout(function () {
		$(this).css({"background-position":"0px -60px","cursor":"default"});
	});
	
	//BTN surf
	$("#btn-surf").click(function () { 
		window.location.href = "?s=surf";
	});
	$("#btn-surf").mouseover(function () {
		$(this).css({"background-position":"200px -90px","cursor":"pointer"});
	});
	$("#btn-surf").mouseout(function () {
		$(this).css({"background-position":"0px -90px","cursor":"default"});
	});
	
	//BTN clothing
	$("#btn-clothing").click(function () { 
		window.location.href = "?s=clothing";
	});
	$("#btn-clothing").mouseover(function () {
		$(this).css({"background-position":"200px -120px","cursor":"pointer"});
	});
	$("#btn-clothing").mouseout(function () {
		$(this).css({"background-position":"0px -120px","cursor":"default"});
	});
	
	//BTN blast-team
	$("#btn-blast-team").click(function () { 
		window.location.href = "?s=blast-team";
	});
	$("#btn-blast-team").mouseover(function () {
		$(this).css({"background-position":"200px -150px","cursor":"pointer"});
	});
	$("#btn-blast-team").mouseout(function () {
		$(this).css({"background-position":"0px -150px","cursor":"default"});
	});
	
	//BTN about-us
	$("#btn-about-us").click(function () { 
		window.location.href = "?s=about-us";
	});
	$("#btn-about-us").mouseover(function () {
		$(this).css({"background-position":"200px -180px","cursor":"pointer"});
	});
	$("#btn-about-us").mouseout(function () {
		$(this).css({"background-position":"0px -180px","cursor":"default"});
	});
	
	//BTN contact-us
	$("#btn-contact-us").click(function () { 
		window.location.href = "?s=contact-us";
	});
	$("#btn-contact-us").mouseover(function () {
		$(this).css({"background-position":"200px -210px","cursor":"pointer"});
	});
	$("#btn-contact-us").mouseout(function () {
		$(this).css({"background-position":"0px -210px","cursor":"default"});
	});
	
	
	//BTN SELECCIONADO
	$("#btn-"+get_seccion()).click(function () { 
		window.location.href = "#";
	});
	
	var seccion = get_seccion();
	var pos = "";
	switch(seccion){
		case "home":
			pos = "200px 0px";
			break;
		case "skate":
			pos = "200px -60px";
			break;
		case "surf":
			pos = "200px -90px";
			break;
		case "clothing":
			pos = "200px -120px";
			break;
		case "blast-team":
			pos = "200px -150px";
			break;
		case "about-us":
			pos = "200px -180px";
			break;
		case "contact-us":
			pos = "200px -210px";
			break;	
	}
	
	$("#btn-"+get_seccion()).css({"background-position":pos,"cursor":"default"});
	$("#btn-"+get_seccion()).mouseover(function () {
		$(this).css({"background-position":pos,"cursor":"default"});
	});
	$("#btn-"+get_seccion()).mouseout(function () {
		$(this).css({"background-position":pos,"cursor":"default"});
	});
});



