$(document).ready(function()
{
	//if((screen.width>=1680)) $('html').css("background","url(http://www.doriangray.sdcafe.rs/wp-content/themes/twentyeleven/images/background.jpg) fixed 200px 0 black");
	
	$(".fb").hover(function()
	{
		$(this).stop().animate(
		{
			opacity: 1 
		}, 300);
	} , function()
	{
		$(this).stop().animate(
		{
			opacity: 0.5
		}, 300);
	});
	
	$(".eng,.rs").hover(function()
	{
		$(this).stop().animate(
		{
			opacity: 1 
		}, 300);
	} , function()
	{
		$(this).stop().animate(
		{
			opacity: 0.56
		}, 300);
	});

	$("#topnav li").each(function()
	{
		var klasa = $(this).find("a").attr("class");
		$(this).prepend("<span class='" + klasa + "'></span>"); //Throws an empty span tag right before the a tag
		var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
		$(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	$("#topnav li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-39" //Find the <span> tag and move it up 40 pixels
		}, 300);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 300);
	});
	
	$("#menifooter a").hover(function()
	{	var src=$(this).find("img").attr("src");
		src =src.substr(0, src.length-4)+"1.png";
		$(this).find("img").attr("src", src);
	} , function() {
		var src=$(this).find("img").attr("src");
		src =src.substr(0, src.length-5)+".png";
		$(this).find("img").attr("src", src);
	});
	
	$("#fsc-submit").addClass("dugme");
	$("#si_contact_message1").css({"width":"290","height":"135"});
	
	
	$("#si_contact_ex_field3_7 option").not(":first").hide();
	$("#si_contact_ex_field3_6").change(function(){
			if($(this).val()=="Pušački")
			{
				$("#si_contact_ex_field3_7 option").first().next().next().next().hide();
				$("#si_contact_ex_field3_7 option").last().hide();
				$("#si_contact_ex_field3_7 option").first().next().show();
				$("#si_contact_ex_field3_7 option").first().next().next().show();
			}
			else
			{
				$("#si_contact_ex_field3_7 option").first().next().hide();
				$("#si_contact_ex_field3_7 option").first().next().next().hide();
				$("#si_contact_ex_field3_7 option").first().next().next().next().show();
				$("#si_contact_ex_field3_7 option").first().next().next().next().next().show();
			}
	});
	
	$("#si_contact_ex_field4_7 option").not(":first").hide();
	$("#si_contact_ex_field4_6").change(function(){
			if($(this).val()=="Smoking")
			{
				$("#si_contact_ex_field4_7 option").first().next().next().next().hide();
				$("#si_contact_ex_field4_7 option").last().hide();
				$("#si_contact_ex_field4_7 option").first().next().show();
				$("#si_contact_ex_field4_7 option").first().next().next().show();
			}
			else
			{
				$("#si_contact_ex_field4_7 option").first().next().hide();
				$("#si_contact_ex_field4_7 option").first().next().next().hide();
				$("#si_contact_ex_field4_7 option").first().next().next().next().show();
				$("#si_contact_ex_field4_7 option").first().next().next().next().next().show();
			}
	});
	
	if(BrowserDetect.browser=="Chrome")
	{
		$("#vt-open").css("float","l !important");
	}
	
	if(BrowserDetect.browser != "Firefox" || BrowserDetect.browser == "Explorer")
	{
		$("#ny").css("margin-left","0 !important");
	}
	
	
});

var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]

};
BrowserDetect.init();

