$(document).ready(function() {
	$.ajax({
		type: "POST",
		url:  "http://www.notariosyregistradores.com/maqueta/linkrotator.ashx?file=urls_publi_wke.xml",
		data: "{}",
		success: function( msg ) {
					var html = "";
					var info = msg.split("|");
					if( info.length == 2 ) {
						if( info[0] == "javascript" ) {
							$('#publi_wke').html( info[1] );
						} else if( info[0] == "image" ) {
							$('#publi_wke').html(info[1]);
						} else if( info[0] == "iframe" ) {
							$('#publi_wke').html(info[1]);
						}
					}
				}, 
		error:   function(XMLHttpRequest, textStatus, errorThrown){
					alert( errorThrown );
				}
	});
	
	$.ajax({
		type: "POST",
		url:  "http://www.notariosyregistradores.com/maqueta/linkrotator.ashx?file=urls_publi.xml",
		data: "{}",
		success: function( msg ) {
					var html = "";
					var info = msg.split("|");
					if( info.length == 2 ) {
						if( info[0] == "javascript" ) {
							$('#publi').html( info[1] );
						} else if( info[0] == "image" ) {
							$('#publi').html(info[1]);
						} else if( info[0] == "iframe" ) {
							$('#publi').html(info[1]);
						}
					}
				}, 
		error:   function(XMLHttpRequest, textStatus, errorThrown){
					alert( errorThrown );
				}
	});
	
	
});

function callJavascript( url, parameters ) {
	var result = "";
	alert(url + "," + parameters);
	$.get({
		type: "GET",
		url:  url,
		data: parameters,
		//contentType: "application/json; charset=utf-8",
		dataType: 'script',
		context: document.getElementById('publi_wke'),
		success: function( msg ) {
			alert("[" + msg + "]");
			msg.replace( "document.write('", "" );
			msg.replace( "');", "" );
			alert("[" + msg + "]");
			result = msg;
		},
		error:   function(XMLHttpRequest, textStatus, errorThrown){
			alert( XMLHttpRequest );
			alert( textStatus );
			alert( errorThrown );
		},
		cache: false
	});
	return result;
}
