// parameters
// \n = new line
// #  = new message
var AdorCestitka_poruka = "Čestit Božić\ni sretna Nova godina#Merry Christmas\nand Happy New Year";
var AdorCestitka_od = new Date( 1971, 11, 15 );  // y,m-1,d - year could be overridden!
var AdorCestitka_do = new Date( 1972, 0, 6 );  // y,m-1,d - year could be overridden!

var AdorCestitka_type = 2;  // 1=gruda, 2=kuća, 3=santa bikers
var AdorCestitka_root = "/Bozicne_cestitke/";
var AdorCestitka_valign = "middle";  //top, bottom, middle
var AdorCestitka_align = "center";  //left, right, center


var AdorCestitka_ignoreYear = true;  // only use year difference between *_od and *_do
var AdorCestitka_FlashContentVersion = 6;










































	
	
var AdorFlash = {
/*
		AdorFlash
		=========
		
		Helps detecting flash player availability/version,
		embedding flash movies into HTML document and displaying flash popups.
		Compatible with MSIE, Firefox and Opera.
		
		methods
		-------
			GetPlayerVersion()
				used to detect flash player; don't call this method, it is run automatically when loading library
			WriteFlash( id, w, h, src, version, alt, bg, wmode, vars, fshandler )
				write HTML code to embed flash movie; arguments up to version are mandatory
			HideFlashMovies( except )
				find and hide all movies in the page
			ShowFlashMovies( except )
				find and show all movies in the page
			Void()
				do nothing
		
		properties
		----------
			PlayerVersion (number)
				major version number of flash player; 0 means there's no flash player
			Tag (string)
				OBJECT or EMBED, depending on the browser

		example
		-------
			Put this into HTML page (header is the best place for this):
			<script language="javascript" src="adorflash.js"></script>
			
			And put this where you need AdorFlash functionality:
			<script language="javascript">
				AdorFlash.WriteFlash( "MyID", 320, 240, "MyFlash.swf", 6, "Sorry to see you don't play flash movies.", "#ffffff", "opaque" );
			</script>

		licence
		-------
		Copyright (C) Ador 2005.   www.ador.hr
		You are free to use this object as long as it contains this comment
		and you don't change any name within.
		Any improvements, fixes or comments can be mailed to nrodic_AT_gmail_DOT_com
		Link back to http://www.ador.hr would be appreciated.

*/
	PlayerVersion: 0,
	
	GetPlayerVersion: function() {
			if( this.PlayerVersion > 0 ) return;
			var _MaxPlayerVersion = 9;
			var _MinPlayerVersion = 4;
			var _plugin = ( navigator.mimeTypes && navigator.mimeTypes[ "application/x-shockwave-flash" ] ) ? navigator.mimeTypes[ "application/x-shockwave-flash" ].enabledPlugin : 0;
			if( _plugin ) {
				var _words = navigator.plugins[ "Shockwave Flash" ].description.split( " " );
				for( var _i = 0; _i < _words.length; ++_i ) {
					if ( isNaN( parseInt( _words[ _i ] ) ) ) continue;
					this.PlayerVersion = parseInt( _words[ _i ] );
					this.Tag = "EMBED";
				};
			} else if( navigator.userAgent && navigator.userAgent.indexOf( "MSIE" ) >= 0 && ( navigator.appVersion.indexOf( "Win" ) != -1 ) ) {
				document.write( '<SCR' + 'IPT LANGUAGE="VBScript"\>\n' );
				document.write( 'AdorCestitka_p = False\n' );
				document.write( 'For AdorCestitka_VersionCounter = ' + _MaxPlayerVersion + ' To ' + _MinPlayerVersion + ' Step -1\n' );
				document.write( '  On Error Resume Next\n' );
				document.write( '  AdorCestitka_p = IsObject( CreateObject( "ShockwaveFlash.ShockwaveFlash." & AdorCestitka_VersionCounter ) )\n' );
				document.write( '  On Error Goto 0\n' );
				document.write( '  If ( AdorCestitka_p ) Then\n' );
				document.write( '    AdorFlash.PlayerVersion = AdorCestitka_VersionCounter\n' );
				document.write( '    AdorFlash.Tag = "OBJECT"\n' );
				document.write( '    AdorFlash.VBS = True\n' );
				document.write( '    Exit For\n' );
				document.write( '  End If\n' );
				document.write( 'Next\n' );
				document.write(' </SCR' + 'IPT\> \n' );
			};
		},
		
	Tag: "",
	
	VBS: false,
	
	Void: function() { return false; },
	
	WriteFlash: function( id, w, h, src, version, alt, bg, wmode, vars, fshandler ) {
			/*
				write object/embed tags for flash movie
					id = id of object/embed element
					w, h = width and height of movie
					src = swf file pathname
					version = minimum supported flash player version
					alt = alternate content (if passed and not empty)
					bg = background color (if passed and not empty)
					wmode = transparent | opaque (if passed and not empty)
					vars = flash vars string (if passed and not empty)
					fshandler = true | false write vbs code for msie fscommand handler (false is default)
			*/
			if( version > this.PlayerVersion ) {
				if( alt ) document.write( alt );
				return;
			};
			if( this.Tag.toLowerCase() == "object" ) {
				//msie object
				document.write( '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + this.PlayerVersion + ',0,0,0" id="' + id + '" name="' + id + '" WIDTH="' + w + '" HEIGHT="' + h + '">\n' );
				document.write( '<PARAM NAME="movie" VALUE="' + src + '">\n' );
				document.write( '<PARAM NAME="menu" VALUE="false">\n' );
				document.write( '<PARAM NAME="quality" VALUE="high">\n' );
				if( bg ) document.write( '<PARAM NAME="bgcolor" VALUE="' + bg + '">\n' );
				if( wmode ) document.write( '<PARAM NAME="wmode" VALUE="' + wmode + '">\n' );
				if( vars ) document.write( '<PARAM NAME="FlashVars" VALUE="' + vars + '">\n' );
				document.write( '</OBJECT>' );
			} else if( this.Tag.toLowerCase() == "embed" ) {
				//netscape embed
				document.write( '<EMBED src="' + swf + '" menu="false" quality="high" width="' + w + '" height="' + h + '"  name="' + id + '" id="' + id + '" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ' );
				if( bg ) document.write( 'bgcolor="' + bg + '" ' );
				if( vars || fshandler ) document.write( 'swLiveConnect="true" ' );
				if( vars ) document.write( 'FlashVars="' + vars + '" ' );
				document.write( '></EMBED>' );
			};
			if( fshandler ) {
				if( this.VBS ) {
					//msie vbscript code
					document.write( '<scr' + 'ipt language="vbscript">\n' );
					document.write( '  function ' + id + '_FSCommand( command, args )\n' );
					document.write( '    call ' + id + '_DoFSCommand( command, args )\n' );
					document.write( '  end function\n' );
					document.write( '</scr' + 'ipt>' );
				};
			};
		},
		
	HideFlashMovies: function( except ) {
			/*
				hide all flash elements in the page
					except (string) = except this one
					except (array) = except those listed here
			*/
			if( !document.getElementsByTagName ) return;
			if( except && typeof( except ) != "string" ) except = except.join( "." );
			if( except ) except = "." + except + ".";
			var els = document.getElementsByTagName( this.Tag );
			var iden;
			for( var i = 0; i < els.length; i++ ) {
				iden = els[ i ].getAttribute( "id" );
				if( iden == "" ) iden = els[ i ].getAttribute( "name" );
				if( !except || ( except && except.indexOf( "." + iden + "." ) == -1 ) ) {
					// not in except list
					els[ i ].setAttribute( "oldVisibility", "." + els[ i ].style.visibility );
					els[ i ].style.visibility = "hidden";
				};
			};
		},
		
	ShowFlashMovies: function( except ) {
			/*
				show all previously hidden (with HideFlashMovies) flash elements in the page
					except (string) = except this one
					except (array) = except those listed here
			*/
			if( !document.getElementsByTagName ) return;
			if( except && typeof( except ) != "string" ) except = except.join( "." );
			if( except ) except = "." + except + ".";
			var els = document.getElementsByTagName( this.Tag );
			var iden, s;
			for( var i = 0; i < els.length; i++ ) {
				iden = els[ i ].getAttribute( "id" );
				if( iden == null || iden == "" ) iden = els[ i ].getAttribute( "name" );
				if( !except || ( except && except.indexOf( "." + iden + "." ) == -1 ) ) {
					// not in except list
					if( ( s = els[ i ].getAttribute( "oldVisibility" ) ) ) {
						els[ i ].style.visibility = s.substr( 1 );
						els[ i ].removeAttribute( "oldVisibility" );
					};
				};
			};
		}
};

AdorFlash.GetPlayerVersion();









function AdorCestitkaShow() {
	var now = new Date();
	if( !AdorCestitka_od ) AdorCestitka_od = now;
	if( !AdorCestitka_do ) AdorCestitka_do = now;
	if( AdorCestitka_ignoreYear ) {
		AdorCestitka_do.setFullYear( now.getFullYear() + AdorCestitka_do.getFullYear() - AdorCestitka_od.getFullYear() );
		AdorCestitka_od.setFullYear( now.getFullYear() );
	};
	AdorCestitka_do.setDate( AdorCestitka_do.getDate() + 1 );
	if( now < AdorCestitka_od ) return;
	if( now > AdorCestitka_do ) return;

	switch( AdorCestitka_type ) {
		case 2:
			swf = AdorCestitka_root + "cestitka_kuca.swf"; width = 600; height = 400; bgColor = "#666666";
			break;
		case 3:
			swf = AdorCestitka_root + "cestitka_santa.swf"; width = 600; height = 400; bgColor = "#666666";
			break;
		case 1:
		default:
			swf = AdorCestitka_root + "cestitka_gruda.swf"; width = 320; height = 240; bgColor = "#666666";
			break;
	};
	var x = 0;
	var y = 0;
	switch( AdorCestitka_align.toLowerCase() ) {
		case "center":
			x = Math.floor( ( document.body.clientWidth - width ) / 2 );
			break;
		case "right":
			x = document.body.clientWidth - width;
			break;
	};
	switch( AdorCestitka_valign.toLowerCase() ) {
		case "middle":
			y = Math.floor( ( document.body.clientHeight - height ) / 2 );
			break;
		case "bottom":
			y = document.body.clientHeight - height;
			break;
	};
	AdorFlash.HideFlashMovies();
	document.write( '<div id="AdorCestitkaDiv" style="position: absolute; top: ' + y + 'px; left: ' + x + 'px; width: ' + (width+16) + 'px; height: ' + (height+20) + 'px; background-color: #fff;"><div style="margin: 8px 8px 0px 8px;">' );
	AdorFlash.WriteFlash( "AdorCestitka", width, height, swf, 6, "<h3>" + AdorCestitka_poruka.replace(/#/g, "<br>") + "</h3>", "#ffffff", "opaque", "sTekstovi=" + AdorCestitka_poruka );
	document.write( '</div><a style="font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: black; text-decoration: none; display: block; text-align: right; padding-right: 8px;" href="javascript:AdorCestitkaClose();">[ close ]</a></div>\n' );
}


function AdorCestitkaClose() {
	AdorFlash.ShowFlashMovies();
	document.getElementById( "AdorCestitkaDiv" ).parentNode.removeChild( document.getElementById( "AdorCestitkaDiv" ) );
}


AdorCestitkaShow();

