var $j = jQuery.noConflict();
$j(".scart").hover(function () {$j(".expassitant").html("&raquo; shopping kolica");},function () {$j(".expassitant").html("");});$j(".spage").hover(function () {$j(".expassitant").html("&raquo; snimljene stranice");}, function () {$j(".expassitant").html("");});$j(".ssman").hover(function () {$j(".expassitant").html("&raquo; smanji asistenta");},function () {$j(".expassitant").html("");});
//SMANJI ASISTENTA
$j(".ssman").live("click", function(){
new Ajax.Request("/cen.php",{method:'post',postBody:'asize=small',onComplete:vn_end});	
loadnow = $j("#sasist").attr("class");
if(loadnow=="scart"){
$j(".asistent").html('<div class="ossmall">osobni asistent | <a rel="'+loadnow+'" href="javascript:;">&raquo; vrati puni prikaz</a></div>');
}else{
$j(".asistent").html('<div class="ossmall">osobni asistent | <a rel="'+loadnow+'" href="javascript:;">&raquo; vrati puni prikaz</a></div>');
}
});
//POVECAJ ASISTENTA
$j(".ossmall a").live("click", function(){
new Ajax.Request("/cen.php",{method:'post',postBody:'asize=full',onComplete:vn_end});
augmasistant();
});
function augmasistant(){
loadonthis = $j(".ossmall a").attr("rel");
//alert(loadonthis);
$j(".asistent").html('<div class="expassitant"></div><a href="javascript:;" class="scart">&nbsp;</a><a href="javascript:;" class="spage">&nbsp;</a><a href="javascript:;" class="ssman">&nbsp;</a><div class="cl"> </div><div class="attcc"></div>');	
if(loadonthis=="spage"){
$j("#sasist").removeAttr("id");
$j(".spage").attr({id:"sasist"});
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumpage=spage',onComplete:getvinum_end});
}else{
$j("#sasist").removeAttr("id");
$j(".scart").attr({id:"sasist"});
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumcart=shopcart',onComplete:getvinum_end});	
}
}
//TRAZILICA
s_search = "s_comp";
$j(".pslc a").live("click", function(){								  
s_search = $j(this).attr("rel");
$j("#pslcsel").removeAttr("id");
$j(this).attr({id:"pslcsel"});
});
clckmpret = 0;
$j(".mpret input").live("click", function(){
if(clckmpret==0){
$j(this).val("");
clckmpret = 1;
}
});
//startaj pretragu ------>
function uprestart(){
if(clckmpret==0){
$j(".mpret input").css({color:"#900"});
setTimeout(function(){$j(".mpret input").css({color:"#666"});},800);	
}else{								   
s_termin = $j(".mpret input").val();
if(s_termin.length<2){
$j(".mpret input").val("unesite minimalno 2 slova");
setTimeout(function(){$j(".mpret input").val("");},800);		
}else{
new Ajax.Request("/cen.php",{method:'post',postBody:'s_termin='+s_termin+'&s_search='+s_search,onComplete:searchend});
}
}	
}
$j(".mprett input").live("click", function(){								   
uprestart();
});
function searchend(req){
prettreza = req.responseText;
if($j(".prr").length > 0){
$j(".prr").remove();$j(".pretraga_cc").append(prettreza);$j(".prr").css({display:"block"});
}else{
$j(".pretraga_cc").append(prettreza);
$j(".prr").slideDown(400);
$j(".mbpcc").fadeOut(200);
$j(".blogo").fadeOut(200);
$j(".blinkss").slideUp(200);
$j(".banner").animate({width:"980px"},500);



}
}
$j(".prr_tt a").live("click", function(){
$j(".prr").slideUp(300,function(){$j(".prr").remove();});

$j(".mbpcc").fadeIn(200);
$j(".blogo").fadeIn(200);
$j(".blinkss").slideDown(200);
$j(".banner").animate({width:"730px"},500);


});
//SNIMI VIJEST
$j(".op_save").live("click", function(){
if($j(".expassitant").length == 0){augmasistant();}									  
ad_cc = $j(this).attr("rel");
$j("#sasist").removeAttr("id");
$j(".spage").attr({id:"sasist"});
//alert(ad_cc);
new Ajax.Request("/cen.php",{method:'post',postBody:'addvinum_page=1&ad_cc='+ad_cc,onComplete:vn_end_get});
});
function vn_end_get(req){	
//alert(req.responseText);
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumpage=spage',onComplete:getvinum_end});
}
//PRINTAJ STRANICU
$j(".op_print").live("click", function(){
window.print();
});
//MAIL-aj STRANICU
$j(".op_mail").live("click", function(){
$j("body").prepend('<div class="entinfo"></div>');
visina = $j(document).height();
$j(".entinfo").css({height:visina+'px'});
new Ajax.Request("/cen.php",{method:'post',postBody:'sendemail=1',onComplete:sendmailend});
});
function sendmailend(req){	
semail = req.responseText;
$j(".entinfo").html(semail);
}
//ODUSTANI OD MAIL-a
$j(".mail_no").live("click", function(){
$j(".entinfo").css({display:"none"});									   
$j(".entinfo").remove();
});
//SLANJE MAIL-a
$j(".mail_ok").live("click", function(){
f_mail = $j(".f_email").val();
m_mail = $j(".m_email").val();
s_mail = $j(".s_email").val();
c_mail = $j(".cc_mail").val();
if(f_mail=="" || m_mail=="" || s_mail=="" || c_mail==""){
alert("popunite sve podatke prije slanja e-maila");	
}else{
$j(".mailcc").html("slanje maila u tijeku . . .");
new Ajax.Request("/cen.php",{method:'post',postBody:'sendemail_go=1&f_mail='+f_mail+'&m_mail='+m_mail+'&s_mail='+s_mail+'&c_mail='+c_mail,onComplete:sendmailend_go});	
}
});
function sendmailend_go(req){	
semail_go = req.responseText;
$j(".mailcc").html(semail_go);
}
function vn_end(req){	
shvv = req.responseText;
//alert(shvv);
}
//VIGET pages
$j(".spage").live("click", function(){
$j("#sasist").removeAttr("id");
$j(this).attr({id:"sasist"});
$j(".attcc").html('<img src="/im/centrala/loadw.gif"/>');
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumpage=spage',onComplete:getvinum_end});
});
//VIGET cart
$j(".scart").live("click", function(){
$j("#sasist").removeAttr("id");
$j(this).attr({id:"sasist"});
$j(".attcc").html('<img src="/im/centrala/loadw.gif"/>');
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumcart=shopcart',onComplete:getvinum_end});
});
//POPULATE ASSISTANT
function getvinum_end(req){	
shvvi = req.responseText;
$j(".attcc").html(shvvi);
}
//DELETE VINUM
$j(".delsnvin").live("click", function(){
delvin = $j(this).attr("rel");
$j(this).parent().remove();
new Ajax.Request("/cen.php",{method:'post',postBody:'delvin='+delvin,onComplete:delaftervin});
});
function delaftervin(req){	
//alert(loadnow);
loadnow = $j("#sasist").attr("class");
if(loadnow=="scart"){
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumcart=shopcart',onComplete:getvinum_end});	
}else{
new Ajax.Request("/cen.php",{method:'post',postBody:'getvinumpage=spage',onComplete:getvinum_end});	
}
}
//float ikone
$j(".op_print").hover(function () {$j(".opttt span").html("isprintaj stranicu");}, function () {$j(".opttt span").html("");});$j(".op_mail").hover(function () {$j(".opttt span").html("prosljedi stranicu na e-mail");}, function () {$j(".opttt span").html("");});$j(".op_save").hover(function () {$j(".opttt span").html("snimi stranicu");},
function () {$j(".opttt span").html("");});$j(".op_kartkl").hover(function () {$j(".opttt span").html("dodaj u kolica");}, function () {$j(".opttt span").html("");});
//LOGIN
$j(".loginget").live("click", function(){
$j(this).remove();
$j(".logwrong").remove();
$j(".adgrup").remove();
$j("#aktub").after('<div class="loginboxup">korsinicko ime: <form action="/" method="post"><input name="username" type="text" /> lozinka: <input name="password" type="password" /><input type="submit" value="logIn" /></form></div>');
});

//FLASH BANNER
if($j("#flashupperbannerpn").length > 0){
flblnk = $j("#flashupperbannerpn").attr("rel");	
var so_na = new SWFObject(flblnk, "mymovie", "728", "90", "8");
so_na.addParam("wmode", "opaque");
setTimeout(function(){so_na.write("flashupperbannerpn");},100);
}
//FOOTER - load more
$j(".ftref").live("click", function(){
ftref_is = $j(this).attr("rel");
$j("."+ftref_is).fadeOut(200,function(){new Ajax.Request("/cen_b.php",{method:'post',postBody:'ftref_is='+ftref_is,onComplete:ftgot});});
});
function ftgot(req){	
ftgotend = req.responseText;
$j("."+ftref_is).html(ftgotend);
$j("."+ftref_is).fadeIn(200);
hoverklubfooter();
}
function hoverklubfooter(){
$j(".footer_pklub a").hover(function () {
movebarb = $j(this).attr("rel");
if(movebarb==1){movebarb = 5;}
if(movebarb==2){movebarb = 52;}
if(movebarb==3){movebarb = 98;}
$j(".footer_pklub").prepend('<div sytle="top:'+movebarb+'px;" class="footnameshow">'+$j(this).attr("title")+'</div>');
$j(".footnameshow").css({top:movebarb+"px"});
},function () {
$j(".footnameshow").remove();
});
}
hoverklubfooter();




