<!--
//script by http://www.yvoschaap.com

//XMLHttpRequest class function

var xmlhttp=false;
var xmlhttpocupado=false;
function datosServidor() {
};
datosServidor.prototype.iniciar = function() {
	try {
		// Mozilla / Safari
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		// Explorer
		var _ieModelos = new Array(
		'MSXML2.XMLHTTP.5.0',
		'MSXML2.XMLHTTP.4.0',
		'MSXML2.XMLHTTP.3.0',
		'MSXML2.XMLHTTP',
		'Microsoft.XMLHTTP'
		);
		var success = false;
		for (var i=0;i < _ieModelos.length && !success; i++) {
			try {
				xmlhttp = new ActiveXObject(_ieModelos[i]);
				success = true;
			} catch (e) {
			}
		}
		if ( !success ) {
			return false;
		}
		return true;
	}
}

datosServidor.prototype.ocupado = function() {
	estadoActual = xmlhttp.readyState;
	return (estadoActual && (estadoActual < 4));
}

datosServidor.prototype.procesa = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		this.procesado = true;
	}
}

datosServidor.prototype.enviar = function(urlget,datos) {
	if (!xmlhttp) {
		this.iniciar();
	}
	if (!this.ocupado()) {
		xmlhttp.open("GET",urlget,false);
		xmlhttp.send(datos);
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			return xmlhttp.responseText;
		}
		
	}
	return false;
}
datosServidor.prototype.enviarpost = function(urlget,datos,elem,mostrar) {
	if (!xmlhttp) {
		this.iniciar();
	}
	if (!this.ocupado()) {
		xmlhttpocupado = true;
		elem.innerHTML = '<img src="/img/ajax-loader.gif" width="15" />';   
		xmlhttp.open("POST",urlget,true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", datos.length);
		xmlhttp.setRequestHeader("Connection", "close");
		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				elem.innerHTML = mostrar;
				xmlhttpocupado = false;
				return xmlhttp.responseText;
			}
		}
		xmlhttp.send(datos);
	}
}

function changewrapper(tipo,stipo){
	var param;
	var sidebar = 0;
	var titulo = tipo;

	if(document.getElementById("sidebars"))
		sidebar = 1;
	if(!stipo){
		param = (tipo != "index" && sidebar ? "0" : "1") ;
		tipo = "?pag="+tipo;
	}
	else if(stipo == 3)
	{
		tipo = "?p="+tipo;
		param = stipo;
	}
	else{
		tipo = "?pag="+tipo;
		param = stipo;
	}
	remoto = new datosServidor;
	nt = remoto.enviar("/hybrid.php"+tipo+"&param="+param);

	if(titulo == "Singlepic"){
		titulo = "Fotos";
		var pos = param.indexOf(".");
		if(pos != -1)
		{
			param = param.substr(0,pos);
		}
		param = "0"+param;
	}
	else if(isBurNumeric(titulo))
		titulo = "Noticias";
	
	window.location.hash = "%"+titulo+(param != '1' && param != '0' ? "&"+param : '') ;
	document.title = getTitle(titulo);

	//enviar

	//cambia todo	-> 0 | >index , is index & >page 
	//cambia middlebox -> 1 | is page & >page

	if(tipo == "?pag=index" || !sidebar) //&& exists sidebar
		document.getElementById("index").innerHTML = nt;
	else
		document.getElementById("middlebox").innerHTML = nt;

	if(titulo == "Contacto"){
		jQuery(document).ready(function() {
			try {
				jQuery('div.wpcf7 > form').ajaxForm({
					beforeSubmit: wpcf7BeforeSubmit,
					dataType: 'json',
					success: wpcf7ProcessJson
				});
			} catch (e) {
			}

			try {
				jQuery('div.wpcf7 > form').each(function(i, n) {
					wpcf7ToggleSubmit(jQuery(n));
				});
			} catch (e) {
			}
		});
	}

	if(titulo == "index"){
		getTwitters('tweet1', {
        id: 'GBoscarino', 
		template: '<h2><a href="http://twitter.com/%user_screen_name%/statuses/%id%/">%user_name%</a></h2><p>%text%</p>',
        clearContents: false, // leave the original message in place
        count: 4, 
        withFriends: true, // currently disabled due to change in Twitter API
        enableLinks: true, 
        ignoreReplies: true,
		newwindow: true,
    });
	}

	try {
		var pageTracker = _gat._getTracker("UA-11156053-1");
		pageTracker._trackPageview();
		} catch(err) {}
}
function keyHandler(e)
{
	if (e == null) { // ie
		keycode = event.keyCode;
	} else { // mozilla
		keycode = e.keyCode;
	}
	key = String.fromCharCode(keycode).toLowerCase();

	if(keycode == 37){	// display previous image
		if(document.getElementById("next") && document.getElementById("next").value)
			changewrapper('Singlepic',document.getElementById("next").value);
	}
	else if(keycode == 39){	// display next image
		if(document.getElementById("prev") && document.getElementById("prev").value)
			changewrapper('Singlepic',document.getElementById("prev").value);
	}
}
function getTitle(input){
	var final = " | gerardoboscarino dj / producer";
	switch(input){
		case "index":
			return "gerardoboscarino dj / producer";
		case "Singlepic":
			return "Fotos"+final;
		case "Fotos":
		case "Social":
		case "Noticias":
		case "Contacto":
			return input+final;
		default:
			return "gerardoboscarino dj / producer";
	}
}
function isBurNumeric(x) {
	var RegExp = /[0-9]/;
	var result = x.match(RegExp);
	return result;
}
function redirect(){
	var hash = window.location.hash;
	var param;
	if(hash){
		var temp = hash.split("&");
		hash = temp[0].substr(2,hash.length);
		param = temp[1];
		if(hash == "index")
			hash = "";

		window.location = "/"+hash+(param ? "/"+param : "");
	}
}

// Exclusive checkbox
function wpcf7ExclusiveCheckbox(elem) {
    jQuery(elem.form).find('input:checkbox[name="' + elem.name + '"]').not(elem).removeAttr('checked');
}

// Toggle submit button
function wpcf7ToggleSubmit(form) {
    var submit = jQuery(form).find('input:submit');
    if (! submit.length) return;

    var acceptances = jQuery(form).find('input:checkbox.wpcf7-acceptance');
    if (! acceptances.length) return;

    submit.removeAttr('disabled');
    acceptances.each(function(i, n) {
        n = jQuery(n);
        if (n.hasClass('wpcf7-invert') && n.is(':checked') || ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
        submit.attr('disabled', 'disabled');
    });
}

function wpcf7BeforeSubmit(formData, jqForm, options) {
	wpcf7ClearResponseOutput();
	jQuery('img.ajax-loader', jqForm[0]).css({ visibility: 'visible' });

    formData.push({name: '_wpcf7_is_ajax_call', value: 1});
    jQuery(jqForm[0]).append('<input type="hidden" name="_wpcf7_is_ajax_call" value="1" />');
  
	return true;
}

function wpcf7NotValidTip(into, message) {
  jQuery(into).append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
	jQuery('span.wpcf7-not-valid-tip').mouseover(function() {
		jQuery(this).fadeOut('fast');
	});
	jQuery(into).find(':input').mouseover(function() {
		jQuery(into).find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
	});
	jQuery(into).find(':input').focus(function() {
		jQuery(into).find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
	});
}

function wpcf7ProcessJson(data) {
	var wpcf7ResponseOutput = jQuery(data.into).find('div.wpcf7-response-output');
	wpcf7ClearResponseOutput();
	if (data.invalids) {
		jQuery.each(data.invalids, function(i, n) {
			wpcf7NotValidTip(jQuery(data.into).find(n.into), n.message);
		});
		wpcf7ResponseOutput.addClass('wpcf7-validation-errors');
	}
	if (data.captcha) {
		jQuery.each(data.captcha, function(i, n) {
			jQuery(data.into).find(':input[name="' + i + '"]').clearFields();
			jQuery(data.into).find('img.wpcf7-captcha-' + i).attr('src', n);
			var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
			jQuery(data.into).find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
		});
	}
    if (data.quiz) {
        jQuery.each(data.quiz, function(i, n) {
            jQuery(data.into).find(':input[name="' + i + '"]').clearFields();
            jQuery(data.into).find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
            jQuery(data.into).find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
        });
    }
	if (1 == data.spam) {
		wpcf7ResponseOutput.addClass('wpcf7-spam-blocked');
	}
	if (1 == data.mailSent) {
		jQuery(data.into).find('form').resetForm().clearForm();
		wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ok');

        if (data.onSentOk)
            jQuery.each(data.onSentOk, function(i, n) { eval(n) });
	} else {
		wpcf7ResponseOutput.addClass('wpcf7-mail-sent-ng');
	}
	wpcf7ResponseOutput.append(data.message).fadeIn('fast');
}

function wpcf7ClearResponseOutput() {
	jQuery('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
	jQuery('span.wpcf7-not-valid-tip').remove();
	jQuery('img.ajax-loader').css({ visibility: 'hidden' });
}
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.onkeyup = keyHandler;
-->

