$(document).ready(function () {
	// bubbles in storecloud
	$('li.storeList').bubble({
		'trigger' : '.trigger', // selector for the trigger element
		'popup' : '.popup', // selector for the actual bubbe (within div) 
		'distance' : 10, // distance in px it will travel
		'hideDelay' : 500, // time before hiding
		'effectTime' : 250 // total time for effect
	});
	// fisheye in brandCloud
	$('#fisheye').Fisheye({
		maxWidth: 35,
		items: 'a',
		itemsText: 'span',
		container: '.fisheyeContainter',
		itemWidth: 85,
		proximity: 80,
		valign: 'bottom',
		halign : 'center'
	});
	$('#fisheye2').Fisheye({
		maxWidth: 35,
		items: 'a',
		itemsText: 'span',
		container: '.fisheyeContainter2',
		itemWidth: 85,
		proximity: 80,
		halign : 'center'
	});
	var browser=navigator.appName;
	if (navigator.userAgent.indexOf("MSIE 6")!=-1) {// disable fisheye for ie6
		$("#k1").attr({src:$("#k1").attr("src").replace(".png",".jpg")});
		$("#k2").attr({src:$("#k2").attr("src").replace(".png",".jpg")});
		$("#k3").attr({src:$("#k3").attr("src").replace(".png",".jpg")});
		$('#fisheye3').FisheyeAlt();
	} 
	else {
		$('#fisheye3').Fisheye({
			maxWidth: 5,
			items: 'a',
			itemsText: 'span',
			container: '.fisheyeContainter3',
			itemWidth: 48,
			proximity: 60,
			alignment : 'left',
			valign: 'bottom',
			halign : 'center'
		});
	}
	// resize holder
	holdersize();
	// svi brandovi link
	$("#svibrandovilink").mouseover(function() {$("#svibrandovilink").css("background","#353535");}).mouseout(function() {$("#svibrandovilink").css("background","#EB6700");}).click(function() {
		$("#svibrandovi").toggle("slow",holdersize);
		
	});
});
function holdersize() {
	var offset = $('#copy').offset();
	var y=offset.top+100;
	var h = (typeof window.innerHeight != 'undefined' ? window.innerHeight : document.documentElement.clientHeight);
	if(y<h) {y=h;}
	$('#holder').css('height',y+'px');

}
function do_send() {
	var a = [];
	var stani=false;
	ela = document.getElementById('imeiprezime');
	strIme=ela.value;
	ela = document.getElementById('email');
	strEmail=ela.value;
	ela = document.getElementById('poruka');
	strPoruka=ela.value;
	if(strPoruka=="Tvoja poruka...") strPoruka="";
	if(strIme=="" || strEmail=="" || strEmail=="Tvoja e-mail adresa..." || strIme=="Tvoje ime..."){alert("Niste ispunili sva obavezna polja!");stani=true;}
	if(!stani) {
		$.post('/kontakti/send/', {imeiprezime:strIme,email:strEmail,poruka:strPoruka}, do_send_cb, "html");
		$('p#xmsg').html("<img src='/images/loading.gif' />");
	}
}
function do_sendfriend() {
	var a = [];
	var stani=false;
	ela = document.getElementById('imeiprezime');
	strIme=ela.value;
	ela = document.getElementById('email');
	strEmail=ela.value;
	ela = document.getElementById('poruka');
	strPoruka=ela.value;
	ela = document.getElementById('imeiprezime2');
	strIme2=ela.value;
	ela = document.getElementById('email2');
	strEmail2=ela.value;
	strOptin="0";
	ela = document.getElementById('optin');
	if(ela.checked) strOptin="1";
	if(strIme=="" || strEmail=="" || strIme2=="" || strEmail2==""){alert("Niste ispunili sva obavezna polja!");stani=true;}
	if(!stani) {
		$.post('/pokloni-popust/send/', {imeiprezime:strIme,email:strEmail,imeiprezime2:strIme2,email2:strEmail2,poruka:strPoruka,optin:strOptin}, do_send_cb, "html");
		$('p#xmsg').html("<img src='/images/loading.gif' width='70' height='30' />");
	}
}
function do_send_cb(data){
	$('span#xf').html(data);
}

function genderFilter(gender){
	$('li','#products').hide('slow');
	$('li[id*="'+gender+'"]').show('slow');
	/*$('li[id*="'+gender+'"]').show('slow',cb_genderFilter);*/
}
function cb_genderFilter() {
	/*var a=parseInt($('li:visible','#products').size());
	for(var i=a;i<=3;i++) {
		$('<li style="float:left;padding-right:8px;padding-top:8px;width:216px;height:216px;position:relative;"><img src=\"/images/no-image.gif\" alt=\"\" width=\"216\" height=\"216\"><br/></li>').appendTo('#products');
	}*/
}

var priloud=new Image;
priloud.src='/images/popup.png';