﻿
var month = '3'; // 1 through 12 or '*' within the next month, '0' for the current month
var day = '13';   // day of month or + day offset
var dow = 0;     // day of week sun=1 sat=7 or 0 for whatever day it falls on
var hour = 20;    // 0 through 23 for the hour of the day
var minute = 0;
var tz = 2;     // offset in hours from UTC to your timezone
var lab = 'stevec';  // id of the entry on the page where the counter is to be inserted


var exDateTime;//Existing Date and Time

//Configurable parameters
var DateSeparator=".";//Date Separator, you can change it to "/" if you want.
var TimeMode=24;//default TimeMode value. 12 or 24

function nastaviCas(){	
	exDateTime=document.getElementById('stevec2').innerHTML;
	if (exDateTime!="")//Parse Date String
	{
		var Sp1;//Index of Date Separator 1
		var Sp2;//Index of Date Separator 2 
		var tSp1;//Index of Time Separator 1
		var tSp1;//Index of Time Separator 2
		var strMonth;
		var strDate;
		var strYear;
		var intMonth;
		var YearPattern;
		var strHour;
		var strMinute;
		var strSecond;
		//parse month
		Sp1=exDateTime.indexOf(DateSeparator,0)
		Sp2=exDateTime.indexOf(DateSeparator,(parseInt(Sp1)+1));
		
		month = exDateTime.substring(Sp1+1,Sp2);
		day = exDateTime.substring(0,Sp1);

		//end parse month
		//parse Date
		//end parse Date
		//parse year
		strYear=exDateTime.substring(Sp2+1,Sp2+5);
		//end parse year
		//parse time
		tSp1=exDateTime.indexOf(":",0)
		tSp2=exDateTime.indexOf(":",(parseInt(tSp1)+1));
		hour=parseInt(exDateTime.substring(tSp1,(tSp1)-2));

			
	}
}

function start() 
{
	displayCountdown(setCountdown(month,day,hour,tz),lab);
	
}

//loaded(lab,start);

// Countdown Javascript
// copyright 20th April 2005, 17th November 2006 by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
// you may change the start function if required
var pageLoaded = 0; 

if (window['_spBodyOnLoadFunctionNames']) {
	_spBodyOnLoadFunctionNames.push("loadPlayer");
}


function loadPlayer() 
{
	pageLoaded = 1;

	if( getCookie('intro') == false){
		prikaziIntro();
		setCookie('intro', '1');
	}//prikaziIntro();
	document.getElementById('videoplayer_bg').style.height = content.document.body.scrollHeight + 'px';
	

}

function prikaziIntro(){
	if(document.getElementById('intro_video')!=null){
		document.getElementById('intro_video').style.display = 'block';
		document.getElementById('overdiv_intro').style.display = 'block';
		//setTimeout('zapriIntro()', 25000);
		document.getElementById('intro_video_container').innerHTML = ' <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="720" height="574">'+
		'  <param name="source" value="flash/SourockVideo.xap"/>'+
		'  <param name="background" value="black" />'+
		'  <param name="minRuntimeVersion" value="3.0.40818.0" />'+
		'  <param name="autoUpgrade" value="true" />'+
		' <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40818.0" style="text-decoration:none">'+
 		'	  <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>'+
		'  </a>'+
	    '</object>';
	}
}

function zapriIntro(){
	document.getElementById('intro_video').style.display = 'none';
	document.getElementById('intro_video_container').innerHTML = '';
	
	document.getElementById('overdiv_intro').style.display = 'none';
}

function prikaziVideoplayer1(container){
	document.getElementById(container).innerHTML='<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="680" height="380"><param name="background" value="#000" /><param name="source" value="Vertigo.SlideShow.xap" /><param name="initParams" value="ConfigurationProvider=DarkTheme,DataProvider=XmlDataProvider;Path=Data.xml" /><a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"><img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /></a>	</object>';

}


function loaded(i,f) 
{	if (document.getElementById && document.getElementById(i) != null) f(); 
	else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}
function setCountdown(month,day,hour,tz) 
{	
	var m = month; 
	if (month=='*') m = 0;  
	var c = setC(m,day,hour,tz); 
	if (month == '*' && c < 0)  c = setC('*',day,hour,tz); 
	return c;

} 

function setC(month,day,hour,tz) 
{var toDate = new Date();

if (day.substr(0,1) == '+') 
	{
		var day1 = parseInt(day.substr(1));
		toDate.setDate(toDate.getDate()+day1);
	} 
	
	else{
		toDate.setDate(day);
	}
	
	if (month == '*')toDate.setMonth(toDate.getMonth() + 1);
	else if (month > 0) 
	{ 
		if (month <= toDate.getMonth())
			toDate.setFullYear(toDate.getFullYear() + 1);
		toDate.setMonth(month-1);
	}
	if (dow >0) toDate.setDate(toDate.getDate()+(dow-1-toDate.getDay())%7);
	toDate.setHours(hour);
	toDate.setMinutes(0-(tz*60));
	toDate.setSeconds(0);
	var fromDate = new Date();
	fromDate.setMinutes(fromDate.getMinutes() + fromDate.getTimezoneOffset());
	var diffDate = new Date(0);
	diffDate.setMilliseconds(toDate - fromDate);
	return Math.floor(diffDate.valueOf()/1000);
}
function displayCountdown(countdn,cd) 
{
	if (countdn < 0) 
		document.getElementById(cd).innerHTML = ""; 
	else 
	{
		var secs = countdn % 60; 
		if (secs < 10) secs = '0'+secs;
		var countdn1 = (countdn - secs) / 60;
		var mins = countdn1 % 60; if (mins < 10) mins = '0'+mins;
		countdn1 = (countdn1 - mins) / 60;
		var hours = countdn1 % 24;
		var days = (countdn1 - hours) / 24;
		document.getElementById(cd).innerHTML = '&nbsp;' +  days+' dni + '+hours+' : '+mins+' : '+secs;setTimeout('displayCountdown('+(countdn-1)+',\''+cd+'\');',999);
	}
}


function setCookie(c_name,value)
{

var exdate=new Date();
exdate.setDate(exdate.getDate());
exdate.setMinutes(exdate.getMinutes()+30);

document.cookie=c_name+ "=" +escape(value)+ ";expires="+exdate.toGMTString();

}

function setCookieAnketa1(c_name,value)
{

var exdate=new Date();
exdate.setDate(exdate.getDate());
exdate.setMinutes(exdate.getMinutes()+180);

document.cookie=c_name+ "=" +escape(value)+ ";expires="+exdate.toGMTString();

}


function getCookie(c_name)
{

	if (document.cookie.length>0)
  	{
  		c_start=document.cookie.indexOf(c_name + "=");
  			if (c_start!=-1)
    		{ 
    			return true;
    		} 
  	}
	return false;
}
