var flatID=1;
var position=0;
var position2=0;

function IsNumeric(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 go_to_search(url)
		{
			var rfl = document.getElementById("flatID").value;
			if(IsNumeric(rfl))
			{
				top.location.href=url;
			}
			
		}


function widthmax(max){
	w = document.documentElement.clientWidth;
	return ((w >= max) ? max + "px" : "316px");
}

function heightmax(max){
	h = document.documentElement.clientHeight;
	return ((h >= max) ? max + "px" : "230px");
}
function func1(anme)
{
	jQuery('#id1').hide();
	jQuery('#id2').html(anme);
	jQuery('#id2').show();
}
function func2()
{
	
	jQuery('#id1').show();
	jQuery('#id2').hide();
}
		
jQuery(document).ready(function()
{	
jQuery("#oblako").html("");
	if(5>fl_count){jQuery('#rightmore').hide();} 
		
	jQuery(".gal3").hide();
	jQuery('#leftmore').click(function()
	{
		var wid=fl_count*170-800;
		position=position+325;
		jQuery("#widthbox").animate({left: "+=325"},'1500');
		if(position>-1){jQuery("#leftmore").hide();}else{jQuery("#leftmore").show();}
		if(position<-wid){jQuery("#rightmore").hide();}else{jQuery("#rightmore").show();}
		
	});
	jQuery('#rightmore').click(function()
	{
		var wid=fl_count*170-800;
		position=position-325;
		jQuery("#widthbox").animate({left: "-=325"}, '1500' );
		if(position<-wid){jQuery("#rightmore").hide();}else{jQuery("#rightmore").show();}
		if(position>-1){jQuery("#leftmore").hide();}else{jQuery("#leftmore").show();}
	});

	jQuery('.gal3').click(function()
	{
		
		position2=position2+21;
		jQuery("#gallery2").animate({left: "+=21"},'500');
		if(position2>-1){jQuery(".gal3").hide();}else{jQuery(".gal3").show();}
		if(position2<-(wid2-231)){jQuery(".gal4").hide();}else{jQuery(".gal4").show();}
		
	});
	jQuery('.gal4').click(function()
	{
		
		position2=position2-21;
		jQuery("#gallery2").animate({left: "-=21"}, '500' );
		if(position2<-(wid2-231)){jQuery(".gal4").hide();}else{jQuery(".gal4").show();}
		if(position2>-1){jQuery(".gal3").hide();}else{jQuery(".gal3").show();}
	});
	

jQuery('#flatID').click(function()
{
	{
		document.getElementById("flatID").value="";
	}
});

jQuery('.gal').click(function()
{
	{
		
		var phid = jQuery(this).text();
		jQuery('.single').each(function()
		{
				this.style.display='none';
		});  
		jQuery('#video_div').hide('');
		jQuery('#flat_map').hide('');
		jQuery('#'+phid).show(''); 
		
	}
});

jQuery('#video').click(function()
{
	jQuery('.single').each(function()
	{
		this.style.display='none';
	});        
	jQuery('#flat_map').hide('');
	jQuery('#video_div').show('');
});

jQuery('#map').click(function()
{
	jQuery('.single').each(function()
	{
		this.style.display='none';
	});        
	jQuery('#video_div').hide('');
	jQuery('#flat_map').show('');
});

});

