function is_numeric(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;

for (i = 0; i < sText.length && IsNumber == true; i++)
 {
 Char = sText.charAt(i);
 if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
 }
return IsNumber;
}

function isIE6(){
var version = navigator.userAgent;
var findIE6 = version.indexOf('MSIE 6');
if(findIE6 != -1) return true;
else return false;
}
$(document).ready(function(){
try{
var FO = { movie:"banner.swf", width:"197", height:"297", majorversion:"8", build:"0", xi:"true", wmode:"transparent"};
UFO.create(FO, "flashBanner");
}catch(err){}

try{
var FO = { movie:"licitatii.swf", width:"438", height:"291", majorversion:"8", build:"0", xi:"true", wmode:"transparent"};
UFO.create(FO, "flashLicitatii");
}catch(err){}

try{
var FO = { movie:"gmt/gmt_02002.swf", width:"185", height:"150", majorversion:"8", build:"0", xi:"true", wmode:"transparent"};
UFO.create(FO, "gmtf");
}catch(err){}

$('#ora').change(function() {
var FO = { movie:"gmt/"+$(this).val(), width:"185", height:"150", majorversion:"8", build:"0", xi:"true", wmode:"transparent"};
UFO.create(FO, "gmtf");
return false;
});


if(typeof sIFR == "function"){
sIFR.replaceElement(named({sSelector:"#bugetulTau h2", sFlashSrc:"interstate.swf", sColor:"#8b5637", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#litoral h2", sFlashSrc:"interstate.swf", sColor:"#0b70af", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#recomandari h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#cele_mai_populare h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#cont h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#hpCont h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:".links h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#linkuri_utile h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#linkuri_recomandari h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
sIFR.replaceElement(named({sSelector:"#ceas h2", sFlashSrc:"interstate.swf", sColor:"#05a308", sWmode:"transparent"}));
};

$('#cont').corner("bl br 13px");
$('.links').corner("bl br tr 13px");
$('#ceas').corner("bl br 13px");
$('#hpCont').corner("bl br 13px");
$('#linkuri_utile').corner("bl br 13px");
$('#linkuri_recomandari').corner("bl br 13px");
$('.vremea').corner("bl br 13px");
$('#cele_mai_populare').corner("bl br 16px");


$('div.sigle ul li').hover(function(){
if($(this).find('span.desc').text() != '') return overlib($(this).find('span.desc').text());
},function(){
if($(this).find('span.desc').text() != '') return nd();
});

/*$('img.info').hover(function(){
return overlib($(this).attr('alt'));
},function(){
return nd();
});

$('input[name=cautaV]').hover(function(){
return overlib($('img.info').attr('alt'));
},function(){
return nd();
});*/


$('#bugetulTau form').submit(function(){
if(!is_numeric($('input[@name=bugetul_tau]').val())) {
alert("Trebuie sa introduceti un numar");
return false;
}
});
$('form.filter select').change(function(){
$('form.filter').submit();
});
$('div.sitemap table td').attr('valign','top');
$('div.sitemap table td').attr('width','278px');

$('#header h1').hover(function(){
if(!isIE6()){
$("#header h1 span").animate({
height: "auto"
}, 500,function(){
$('#header h1').css('height', 'auto');
$('#header h1').css('paddingBottom', '8px');
$('#header h1 span').css('height', 'auto');
});

$("#header h1").animate({
height: "auto",
paddingBottom: "8px"
}, 500);
} else {
$('#header h1').css('height', 'auto');
$('#header h1').css('paddingBottom', '8px');
$('#header h1 span').css('height', 'auto');
}
},
function(){
if(!isIE6()){
$("#header h1").animate({
height: "22px",
paddingBottom: "0"
}, 500);

$("#header h1 span").animate({
height: "14px"
}, 500);
} else {
$('#header h1').css('height', '22px');
$('#header h1').css('paddingBottom', '0');
$('#header h1 span').css('height', '14px');
}
});

$('#sVremea').submit(function() {
var vCauta = $('#oras').val();
if(vCauta == '') alert('Va rugam scrieti numele orasului');
else {
$('.info').css('display', 'block');

$.ajax({
url: 'server.php',
type: 'POST',
dataType: 'html',
data: 'oras='+vCauta+'&action=getVreme',
success: function(html) {
$('.info').css('display', 'none');
$('#vremeaUl').remove();
$('#sVremea').after(html);
},
error: function() {
//called when there is an error
}
});
}
return false;
});

});

