var loadingIcon = "<img src='typo3conf/ext/dp_immobilien/res/images/ajax-loader.gif' class='loadingIcon' />";
var loadingIcon2 = "<img src='typo3conf/ext/dp_immobilien/res/images/ajax-loader2.gif' class='loadingIcon2' />";
var app = 0;

function selectFirst(num){
	
	$('immoSeiteSelect1').set('html', '');
	$('immoSeiteSelect1').set('opacity','0'); 
	if($('immoSeiteSelect2').style.visibility == "visible") $('immoSeiteSelect2').fade(0);
	
	var myEffect = new Fx.Morph('immoSeiteSelect1', {duration: 'short'});
 
	myEffect.start({
	    'opacity': [0, 1],
	    'top': [30, 0]
	});

	app = num;
	
	var requestURL = "index.php?id=3&eID=immo&sec=1&app="+num+"&L="+language;
	
	var req = new Request.HTML({url:requestURL, 
		onSuccess: function(object, array, html) {
			
			$('immoSeiteSelect1').set('html', html);
			
		},
		onFailure: function() {
			$('immoSeiteSelect1').set('html', 'Es ist ein Fehler aufgetreten!');
		}
	});
	
	req.send();
	
}

function selectSecond(det){
	
	$('immoSeiteSelect2').set('html', '');
	$('immoSeiteSelect2').set('opacity','0'); 
	
	var myEffect = new Fx.Morph('immoSeiteSelect2', {duration: 'short'});
 
	myEffect.start({
	    'opacity': [0, 1],
	    'top': [30, 0]
	});

	
	var requestURL = "index.php?id=3&eID=immo&sec=2&app="+app+"&detail="+det+"&L="+language;
	
	var req = new Request.HTML({url:requestURL, 
		onSuccess: function(object, array, html) {
			
			$('immoSeiteSelect2').set('html', html);
			
		},
		onFailure: function() {
			$('immoSeiteSelect2').set('html', 'Es ist ein Fehler aufgetreten!');
		}
	});
	
	req.send();
	
}

function detailView(uid){
	
	$('listView').style.visibility = "hidden";
	$('detailView').set('html', loadingIcon2);
	$('detailView').style.display = "block";
	
	var requestURL = "index.php?id=3&type=86&L="+language+"&tx_dpimmobilien_pi1[single]="+uid;
	
	var req = new Request.HTML({url:requestURL, 
		onSuccess: function(object, array, html) {
			
			$('detailView').set('html', html);
			
		},
		onFailure: function() {
			$('detailView').set('html', 'Es ist ein Fehler aufgetreten!');
		}
	});
	
	req.send();
	
	
}

function detailBack(){
	
	$('listView').style.visibility = "visible";
	$('detailView').style.display = "none";
	
}

function changeImage(src){
	
	$('immo-bigImage').set('html', '<img src="'+src+'" border=0 />');
	
}

function selectFast(num){
	
	if(num == 1) location.href = linkNum1;
	if(num == 2) location.href = linkNum2;
	if(num == 3) location.href = linkNum3;
	if(num == 4) location.href = linkNum4;
	 
}
