function isPPC() {
	if (navigator.appVersion.indexOf("PPC") != -1) return true;
	else return false;
}

function sendPage(mailHeadline){
	var href= window.location + "";
	href = href.substr(0, href.indexOf("/", 7));
	if(!isPPC()) {
		window.location="mailto:\?subject\=" + mailHeadline + "&body=" + mailHeadline + ": " + href;
	}else { 
		window.location="mailto:\?body=" + mailHeadline + ": " + href;
	}
}



function ajax(value, curr1, curr2, resultDiv){
	if (isNaN(value) || value == ""){
		alert("Morate uneti numericku vrednost.");
		return false;
	}else{
		targetDiv = resultDiv;
		
		xmlHttpCustom = GetXmlHttpObjectCustom();

		if (xmlHttpCustom == null){
			alert ("Browser does not support HTTP Request");
			return;
		}

		url = "/php/news/calculator_ajax.php?exchangeValue="+value+"&curr1="+curr1+"&curr2="+curr2;

		xmlHttpCustom.onreadystatechange = stateChangedCustom;
		xmlHttpCustom.open("GET",url,true);
		xmlHttpCustom.send(null);
	}
}

function stateChangedCustom() {
	if (xmlHttpCustom.readyState == 4 || xmlHttpCustom.readyState == "complete"){
		document.getElementById(targetDiv).innerHTML = xmlHttpCustom.responseText;
	}
}

function GetXmlHttpObjectCustom(){
	var xmlHttp = null;

	try{
		xmlHttp = new XMLHttpRequest();
	}	catch (e){
		try	{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	return xmlHttp;
}

function noEnterKey(){
	if (window.event && window.event.keyCode == 13)	{
		return false;
	}
}
