//VIJESTI SWAP
$j(".newslinks a").hover(function () {		   
$j("#nwslc").removeAttr("id");	
$j(this).attr({id:"nwslc"});
nrel = $j(this).attr("rel");
//alert(gn[nrel]);
$j(".newsbox").html(gn[nrel]);
},
function () {});
gn=new Array();
$j(".newslinks a").each(function (i) {
gnews = $j(this).attr("rel");
newsgo(gnews);
});
function newsgo(gg){
//alert(gg);
new Ajax.Request("/cen.php",{method:'post',postBody:'gnews='+gg,onComplete:gnewsend});	
}
function gnewsend(req){
shvvi = req.responseText;
sc_i = shvvi.split("xxxxx");
gn[sc_i[0]] = sc_i[1];
}
//VALUTE
fval = 0;
function exvalu(){
if(ev==0){
$j(".val_a").css({color:"#900"});
setTimeout(function(){$j(".val_a").css({color:"#666"});},800);
}else{	
if(fval==0){
$j(".exrez").animate({height:"20px",padding:"6px",paddingTop:"10px"},200);
fval = 1;
}
$j(".exrez").html('<img style="display:none" src="/im/centrala/lcur.gif"/>');
$j(".exrez img").fadeIn(200);
val_iz = $j(".val_iz").val();
val_u = $j(".val_u").val();
val_a = $j(".val_a").val();
new Ajax.Request("/cen.php",{method:'post',postBody:'excur=1&val_iz='+val_iz+'&val_u='+val_u+'&val_a='+val_a,onComplete:valend});
}	
}
$j(".exnow").live("click", function(){					
exvalu();
});
function valend(req){
valvii = req.responseText;
$j(".exrez").html(valvii);
$j(".innerconverted").fadeIn(200);
}
//enter value
ev = 0;
$j(".val_a").live("click", function(){
if(ev==0){
$j(".val_a").val("");
ev = 1;
}
});





//VIDEO NASLOVNICA
function startvideoplayer(){
//playvideofile = $j("#nvideo").attr("rel");
var so = new SWFObject('/sc/player.swf','ply','466','344','8','#ffffff');
so.addParam('allowfullscreen','true');
so.addParam('allowscriptaccess','always');
so.addParam('wmode','opaque');

so.addVariable('controlbar','none');
so.addVariable('autostart','true');  
so.addVariable('backcolor','FFFFFF');
so.addVariable('frontcolor','333333');
so.addVariable('lightcolor','999999');
so.addVariable('screencolor','333333');
so.addVariable('skin','/sc/modieus.swf');
so.addVariable('repeat','always');
so.addVariable('file','commerc.php');  
so.addVariable('stretching','fill');
so.addVariable('displayclick','link');
so.addVariable('repeat','always');
so.addVariable('linkfromdisplay','true');
so.addVariable('linktarget','_self');

so.addVariable('volume',0);
//so.addVariable('controlbar','over');
so.write('nvideo');	
}
startvideoplayer();
// video reklama open up
function UnserLink(web) {
if(web==undefined || web==""){
}else{fenster = window.open("http://"+web, "fenster1", "width=1024,height=600,status=yes,scrollbars=yes,resizable=yes");
fenster.focus();
}
}








//COMPANY SELECTOR
cholder=new Array();
cl_z = 1000;
$j(".kselector a").live("click", function(){
if($j(this).attr("id")!="ks_sele"){
$j("#ks_sele").removeAttr("id");
$j(this).attr({id:"ks_sele"});
csel_id = $j(this).attr("rel");
clorder = $j(this).attr("rev");
if(cholder[clorder]=="" || cholder[clorder]==undefined){
//alert("novi..");	
new Ajax.Request("/cen_b.php",{method:'post',postBody:'csel_id='+csel_id,onComplete:csel_end});	
}else{
//alert("imammo");	
csel_ii = cholder[clorder];
$j(".kselector").after(csel_ii);
cl_z = cl_z + 1;
$j(".pkompinner:first").css({zIndex:cl_z});
$j(".pkompinner:first").animate({top:"5px"},600);
//$j(".pkompinner:last").animate({top:"514px"},1400,'',function(){$j(".pkompinner:last").remove();});
$j(".pkompinner:last").fadeOut(400,function(){$j(".pkompinner:last").remove();});	
}
}
});

//push company in
function csel_end(req){
csel_ii = req.responseText;
//alert("iz req:"+clorder);
cholder[clorder] = csel_ii;
$j(".kselector").after(csel_ii);
cl_z = cl_z + 1;
$j(".pkompinner:first").css({zIndex:cl_z});
$j(".pkompinner:first").animate({top:"5px"},600);
//$j(".pkompinner:last").animate({top:"514px"},1400,'',function(){$j(".pkompinner:last").remove();});
$j(".pkompinner:last").fadeOut(400,function(){$j(".pkompinner:last").remove();});
}

//COMPANY AUTORUNNER
allowautorunner = 1;
juststartedauto = 1;
xx = 0;
$j(".kselector a").each(function (i) {
xx = xx + 1;								  
$j(this).attr({rev:xx});
});
clorder = 1;
function autorunner(){
	
if(juststartedauto==1){
juststartedauto = 0;
waitper = 2500;
}else{
waitper = 5000;	
}
	
	
if(allowautorunner == 1){
timerunner = setTimeout(function(){								 
clorder = clorder + 1;
if(clorder>6){
clorder = 1;	
}								 
$j("#ks_sele").removeAttr("id");
$j(".kselector a[rev='"+clorder+"']").attr({id:"ks_sele"});
csel_id = $j(".kselector a[rev='"+clorder+"']").attr("rel");
//alert(clorder);
//alert(cholder[clorder]);
if(cholder[clorder]=="" || cholder[clorder]==undefined){
//alert("novi..");
new Ajax.Request("/cen_b.php",{method:'post',postBody:'csel_id='+csel_id,onComplete:csel_end});
}else{
//alert("imamo");	
csel_ii = cholder[clorder];
$j(".kselector").after(csel_ii);
cl_z = cl_z + 1;
$j(".pkompinner:first").css({zIndex:cl_z});
$j(".pkompinner:first").animate({top:"5px"},600);
//$j(".pkompinner:last").animate({top:"514px"},1400,'',function(){$j(".pkompinner:last").remove();});
$j(".pkompinner:last").fadeOut(400,function(){$j(".pkompinner:last").remove();});
}
autorunner();
},waitper);
}
}

autorunner();

//COMPANY AUTORUNNER - hold
$j(".pkomp").hover(function () {
allowautorunner = 0;
clearTimeout(timerunner);
},
function () {
allowautorunner = 1;
autorunner();
});

//MAIL LIST
$j(".snimi_mlista").live("click", function(){						
mlista = $j(".mlista").val();
mlista_ime = $j(".mlista_ime").val();
if(mlista==""){
alert("molimo unesite e-mail");	
}else{
	
if(mlista_ime==""){
alert("molimo unesite ime");	
}else{
new Ajax.Request("/cen_b.php",{method:'post',postBody:'mlista='+mlista+'&mlista_ime='+mlista_ime,onComplete:endlista});
$j(".listaopis").html("hvala. Upisali ste se u poslovnu listu.");	
}
	

}
});
function endlista(req){
ell = req.responseText;
//alert(ell);
}





   
var so_dn = new SWFObject("http://www.poslovnacentrala.com/flash/wshop_250x240.swf?client=all", "mymovie", "250", "240", "8");
so_dn.addParam("wmode", "opaque");
setTimeout(function(){so_dn.write("flashshop_id");},100); 
 