var banner_moves = [];
var banner_id_shown = 0;
cookie_path = ".24ur.com";

video_needs_access_token = true;

banners = new Array(
	new Array("A" ,30 , "banner_A", "", 0, 728, 0, 0),
	new Array("A1" ,34 , "banner_A1", "", 0, 300, 0, 0),
	new Array("A2" ,33 , "banner_A2", "", 0, 300, 0, 0),
	new Array("B" ,31 , "banner_B", "", 0, 650, 0, 0),
	new Array("B1" ,32 , "banner_B1", "", 0, 575, 0, 0),
	new Array("G" ,36 , "banner_G", "", 0, 160, 0, 0),
	new Array("H" ,37 , "banner_H", "", 0, 300, 0, 0),
	new Array("M" ,50 , "banner_M", "", 0, 300, 0, 0),
	new Array("M2" ,51 , "banner_M", "", 0, 300, 0, 0),
	new Array("M3" ,76 , "banner_M", "", 0, 300, 0, 0),
	new Array("M4" ,77 , "banner_M", "", 0, 300, 0, 0),
	new Array("N2" ,66 , "banner_N", "", 0, 290, 0, 0),
	new Array("Y" ,33 , "banner_Y", "", 0, 650, 0, 0),
	new Array("O" ,90 , "banner_O", "", 0, 300, 0, 0),
	new Array("T" ,52 , "banner_T", "", 0, 990, 0, 0),
	new Array("BANDEROLA" ,89 , "banner_BANDEROLA", "", 0, 160, 0, 0),
	new Array("FLOATER"   ,38 , "banner_FLOATER"  , "", 1, 0),
	new Array("PIXEL"   ,39 , "banner_PIXEL"  , "", 5, 0),
	new Array("CONTEXTUAL", 45, "banner_CONTEXTUAL"  , "", 7),
	new Array("VIDEO_PRE", 11, "banner_VIDEO_VID_PRE"  , "", 3),
	new Array("VIDEO_MID", 12, "banner_VIDEO_VID_MID"  , "", 3),
	new Array("VIDEO_POST", 13, "banner_VIDEO_VID_POST"  , "", 3),
	new Array("VIDEO_IMG_PRE", 21, "banner_VIDEO_IMG_PRE"  , "", 4, 300, 0),
	new Array("VIDEO_IMG_MID", 22, "banner_VIDEO_IMG_MID"  , "", 4, 300, 0),
	new Array("VIDEO_IMG_POST", 23, "banner_VIDEO_IMG_POST"  , "", 4, 300, 0),
	new Array("VIDEO_OVERLAY"   ,42 , "banner_OVERLAY"  , "", 3)
);

var bannerT_Effect;

function bannerT_resize_to_full( height )
{

	var div_banner = $j("#resizable_banner");
	var div_parent = div_banner.parent();

	var height = div_banner.find("embed, object, img").css("height");
  
  	div_parent.stop();
	div_parent.animate({height: height}, 500, 
		function() { 
			div_banner.css("clip",resizable_banner_clip_exploded);
		});
}

function bannerT_resize_back()
{
	var div_banner = $j("#resizable_banner");
	var div_parent = div_banner.parent();

	var height = 40;

  	div_parent.stop();
	div_parent.animate({height: height}, 500, 
		function() { 
			div_banner.css("clip",resizable_banner_clip_collapsed);
		});

}


function banner_move()
{
	if ( banner_moves == undefined )
		return;
	if ( banner_moves.length == null )
		return;
	if ( banner_moves.length <= 0 )
		return;

	for (i=0; i<banner_moves.length; i++) {
		if ( $j("#" + banner_moves[i][1]) && $j("#" + banner_moves[i][0]) ) {
			$j("#" + banner_moves[i][1]).html( $j("#" + banner_moves[i][0]).html() );
		}
	}
}

/* Functions for resizable banners */
function dolittle()
{
	collapse();
}

function doexpand()
{
	explode();
}

	$j(document).ready( function () {
		banner_move();
	});

/**
 * Function returns JS for normal banner
 */
function banner_get_variable_by_time(zoneid, bannerid, time_from, time_to) {

        var awrz_rnd = Math.floor(Math.random()*99999999999);

        if (!document.phpAds_used) document.phpAds_used = ',';

        banner  = "<" + "script language='JavaScript' type='text/javascript' src='";
        banner += "/adserver/adjs_var_time.php?n=" + zoneid;
        banner += "&zoneid=" + zoneid + "&bannerid=" + bannerid + "&target=_blank";
        banner += "&exclude=" + document.phpAds_used;
        banner += "&time_from=" + time_from;
        banner += "&time_to=" + time_to;
        banner += "&loc=" + escape(window.location);
        if (document.referrer)
                banner += "&referer=" + escape(document.referrer);
        banner += '&r=' + awrz_rnd;
        banner += "&ct0=" + escape(document.phpAds_ct0);

        banner += "'><" + "/script>\n";

        return banner;
}

/**
 * Needed for peel-off banner
 */
function sizeup987(){
	document.getElementById('jcornerBig').style.top = '23px';
	document.getElementById('jcornerSmall').style.top = '-1000px';
}

/**
 * Needed for peel-off banner
 */
function sizedown987(){
	document.getElementById("jcornerSmall").style.top = "23px";
	document.getElementById("jcornerBig").style.top = "-1000px";
}

/**
 * Call this function from adserver for peel-off banner
 * 
 * small_img and big_img are files in the /adserver/banners/ folder
 * Small img is 100x100 image, Big image is 650x650 image.
 * URL can be {url} so that we'll take whatever is in banner params.
 * 
 * Example of JS for adserver:
 * <scrip>
 *	var small_img = 'peel_mali.jpg';
 *	var big_img = 'peel_veliki.jpg';
 *	var url = '{url}';
 *
 *	banner_peel(small_img, big_img, url);
 * </scrit>
 */
function banner_peel(small_img, big_img, ad_url) {
	small_img = "/adserver/banners/peel/" + small_img;
	big_img = "/adserver/banners/peel/" + big_img;

	$j(document).ready( function() {
		var html = "";
		
		html += '<div id="jcornerSmall" style="position:absolute;width:100px;height:100px;z-index:9999;right:0px;top:23px;">';
		html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		html += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"';
		html += ' id="jcornerSmallObject" width="100" height="100">';
		html += '	<param name="allowScriptAccess" value="always"/> ';
		html += '	<param name="movie" value="/static/slo/shared/js/peel/small.swf?ico='+ escape(small_img) +'"/>';
		html += '	<param name="wmode" value="transparent" />';
		html += '	<param name="quality" value="high" /> ';
		html += '	<param name="FlashVars" value="ico='+escape(small_img)+'"/>';
		html += '	<embed src="/static/slo/shared/js/peel/small.swf?ico='+ escape(small_img) +'" name="jcornerSmallObject" wmode="transparent" quality="high" width="100" height="100" flashvars="ico='+escape(small_img)+'" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		html += '</object></div>';

		html += '<div id="jcornerBig" style="position:absolute;width:650px;height:650px;z-index:9999;right:0px;top:-1000px;">';
		html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		html += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"';
		html += ' id="jcornerBigObject" width="650" height="650">';
		html += '	<param name="allowScriptAccess" value="always"/> ';
		html += '	<param name="movie" value="/static/slo/shared/js/peel/large.swf?big=' + escape(big_img) + '&ad_url=' + ad_url + '"/>';
		html += '	<param name="wmode" value="transparent"/>';
		html += '	<param name="quality" value="high" /> ';
		html += '	<param name="FlashVars" value="big=' + escape(big_img) + '&ad_url=' + ad_url + '"/>';
		html += '	<embed src="/static/slo/shared/js/peel/large.swf?big=' + escape('/static/slo/shared/js/peel/large.jpg') + '&ad_url=' + ad_url + '" id="jcornerBigEmbed" name="jcornerBigObject" wmode="transparent" quality="high" width="650" height="650" flashvars="big=' + escape(big_img) + '&ad_url=' + ad_url + '" swliveconnect="true" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
		html += '</object></div>';

		$j('body').append(html);
	});

}

/**
 * Used for popup banners for submitting forms.
 */
if (typeof upload_form_open != 'function') {

        function upload_form_open() {
                close_banner();
                mbox_open(500, 500);
                pre_fullscreen();
                new Ajax('/lbin/ajax_award_game_upload_form.php', {
                        method: 'get',
                        data: { 'key' : 'history' },
                        encoding: 'utf-8',
                        update: $('MBOX_window'),
                        evalScripts: true
                }).request();
        }
}

$j(document).ready(function() {
        if (top.location.hash.indexOf("zapisimo_zgodovino") != -1) {
                upload_form_open();
        }
});

