/* GENERAL SETTINGS */
var ROOT_URL = 'http://www.confortcity.ro/';
var AJAX_PHP_URL = ROOT_URL+'&resources/ajax/';

function setupSifr() { 
	
	
	if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac ){

        


		sIFR.bAutoInit=true;

		sIFR.replaceElement("h3.motto", named({sFlashSrc: ROOT_URL+"&resources/swf/futura.swf", sWmode: "transparent", sColors: "#ffffff"}));
		sIFR.replaceElement("h3.title", named({sFlashSrc: ROOT_URL+"&resources/swf/futura.swf", sColor: "#dfd700", sWmode: "transparent"}));
		sIFR.replaceElement("#offers h3", named({sFlashSrc: ROOT_URL+"&resources/swf/futura.swf", sColor: "#ffffff", sWmode: "transparent"}));
		sIFR.replaceElement("#apartment_types h2.title", named({sFlashSrc: ROOT_URL+"&resources/swf/futura.swf", sColor: "#ffffff", sWmode: "transparent"}));
		sIFR.replaceElement("#temporaryNotice", named({sFlashSrc: ROOT_URL+"&resources/swf/futura.swf", sColor: "#ffffff", sWmode: "transparent"}));

		sIFR.setup();

//		var context = document.body.id;
//		if (context == 'mission' || context == 'legal') {
//			sIFR.replaceElement("h2.graphic", named({sFlashSrc: "/&resources/sifr/sifr2.0/franklingothic.swf", sColor: "#000"}));
//		}
		
	};
}

function parseLinks() {
	var as = document.getElementsByTagName('a');
	var as_no = as.length;
	if (as_no == 0) return false;
	
	for (var i = 0; i < as_no; i++) {
		if (as[i].rel == 'external') as[i].target = "_blank";
	}
	
}


function openMailAddress(obj) {
	
	var url = AJAX_PHP_URL+"controller.php";
	var pars = "action=openMailAddress&addr="+obj.innerHTML;
	var myAjax = new Ajax.Request(
		url,
		{ 
			method: 'post',
			parameters: pars,
			onSuccess: function(transport) {
				obj.href = 'mailto:'+transport.responseText;
				document.location.href = 'mailto:'+transport.responseText;
			}
		}
	);
	
}


function showcaseNavigation(mode,pic) {

	var picture = document.getElementById("pic");
	var no = picture.name.replace("pic","");

	if (mode == 'previous') { no--; } else { no++; }
	if (no > 48) { no = 1; }
	if (no < 1 ) { no = 48; }
	
	if (pic) {
		no = pic.id.replace("pic","");	
	}
	
	new Effect.Fade(picture, {
		duration: 0.5,
//		transition: Effect.Transitions.linear,
		afterFinish: function() {
			picture.name = "pic"+no;
			picture.src =  ROOT_URL+"&resources/img/visuals/gallery/confort-city-"+no+".jpg";
			picture.appear({ delay: 0, duration: 0.5});
		}
	});
	
}

function showPlan(no) {



	var container = document.getElementById("picutre_container");
	container.style.display='block';
	container.innerHTML = "<img src='"+ROOT_URL+"&amp;resources/img/visuals/plans/ap"+no+".jpg' alt='Apartamentul "+ no +"' />";

}

function hideErrors() {
	document.getElementById("errors").style.display = 'none';
}

function showErrors() {
	document.getElementById("errors").style.display = 'block';
}

function hidePlan() {
	var container = document.getElementById("picutre_container");
	container.style.display = 'none';
}

function go_cufon_go()
{
	var main_font = 'Futura';

	Cufon.replace('h3.motto, h3.title, #offers h3, #apartment_types h2.title, .contact h2', {fontFamily: main_font});
}
