var width = 600;
var height = 500;
var popup = new Popup();
var popup2 = new Popup();
function loadCat(section, cat_id, target_div, extra_param, from)
{
if (from == undefined) {
from = 0;
}
callA('content', {
section: section,
cat: cat_id,
extra: extra_param,
from: from
}, function(txt) {
var tt = txt.split('][');
txt = tt[0];
$('#' + target_div).html(txt);
});
}
function showrec(section, rec_id)
{
callA('file', {
section: section,
rec: rec_id
}, function(txt) {
tt = txt.split('||');
txt = tt[0];
var title = tt[1];
$('#dialog2').dialog('option', 'title', title);
$('#dialog2').html('
' + txt + '
');
$('#dialog2').dialog('open');
//execScript(cdiv);
/*
//popup2 = new Popup();
popup2.width = 600;
popup2.height = 580;
popup2.autoHide = false;
popup2.content = 'Затвори
';
popup2.content = popup2.content + txt + '
';
popup2.style = {};
popup2.show();
//$('#'+cdiv).corner('6px #000');
$('#'+cdiv).css('overflow', 'hidden');
$('.PopupDiv').css('overflow', 'hidden');
*/
});
return false;
}
function callA(func, params, handler)
{
dataArray = params;
dataArray.fx = func;
$.ajax({
url: 'ajax.php',
data: dataArray,
type: 'GET',
dataType: 'text',
timeout: 20000,
error: function() {
},
success: function(txt) {
handler(txt);
}
});
}
function execScript(d) {
switch (d) {
case 'hsl1':
loadCat('coffee','0', 'content', '');
break;
case 'hsl2':
loadCat('service','0', 'content', '');
break;
case 'hsl3':
loadCat('products','0', 'content', '');
break;
case 'hsl4':
loadCat('coin','0', 'content', '');
break;
case 'hsl5':
loadCat('top','0', 'content', '');
break;
default:
break;
}
}
jQuery(document).ready(function(){
jQuery('#mc_home').flash({
id: 'flash',
src: 'home4-bg-first.swf',
expressInstall: true,
width: 1019,
height: 668,
wmode : 'transparent'
},
{
version: 8
});
$('#dialog1').dialog({
autoOpen: false,
width: 650,
height: 550,
close: function(event, ui) {
jQuery('#mc_home').html('');
jQuery('#mc_home').flash({
id: 'flash2',
src: 'home4-bg.swf',
expressInstall: true,
width: 1019,
height: 668,
wmode : 'transparent'
},
{
version: 8
});
}
});
$('#dialog2').dialog({
autoOpen: false,
width: 500,
height: 580,
modal: true
});
});
// close primary popup
function closePopup()
{
popup.hide();
jQuery('#mc_home').html('');
jQuery('#mc_home').flash({
id: 'flash2',
src: 'home4-bg.swf',
expressInstall: true,
width: 1019,
height: 668,
wmode : 'transparent'
},
{
version: 8
});
}
function render(id)
{
$("#mc_home").addClass("bg2");
switch (id) {
case 1:
title = 'Кафе автомати';
file = 'coffee';
width = 600;
height = 500;
break;
case 2:
title = 'Сервиз';
file = 'service';
width = 600;
height = 300;
break;
case 3:
title = 'Продукти';
file = 'products';
width = 600;
height = 500;
break;
case 4:
title = 'Платежни системи';
file = 'coin';
width = 600;
height = 500;
break;
case 5:
title = 'Топ оферти';
file = 'top';
width = 600;
height = 500;
break;
}
adiv = 'hsl' + id;
cdiv = 'hsl' + id + 'c';
renderAjax(file);
}
// close details popup
function closeDiv(popup_ref)
{
popup_ref.hide();
}
function renderAjax(section)
{
$('#flash').hide();
$('#flash2').hide();
callA('content', {
section: section,
cat: 0,
full: 1
}, function(txt) {
var tt = txt.split('][');
txt = tt[0];
var title = tt[1];
$('#dialog1').dialog('option', 'title', title);
$('#dialog1').dialog('option', 'height', height);
$('#dialog1').html('' + txt + '
');
$('#dialog1').dialog('open');
execScript(adiv);
});
return;
}