<!-- 

if(navigator.userAgent && navigator.userAgent.indexOf('MSIE') != -1)
{
	void(document.execCommand("BackgroundImageCache", false, true));
}

function trim_string(ovo)
{
	var s = ovo;
	
	while (s.substring(0,1) == " "){
		s = s.substring(1,s.length);
	}
	
	while (s.substring(s.length-1,s.length) == " "){
		s = s.substring(0,s.length-1);
	}
	return s;
}


function markChecked(chk_list)
{
	var Boxes = new Array();
	Boxes['eur'] = 'chk_eur';
	Boxes['chf'] = 'chk_chf';
	Boxes['gbp'] = 'chk_gbp';
	Boxes['usd'] = 'chk_usd';
	Boxes['jpy'] = 'chk_jpy';
	
	var Temp = chk_list.split(',');
	
	for(i=0; i<Temp.length; i++)
	{
		var chk_box = document.getElementById(Boxes[Temp[i]]);
		
		if(chk_box)
		{
			chk_box.checked = true;
		}
	}
}


function SortTable(table_id, default_order, norm_row_class, alt_row_class)
{	
	/**
	 * sort table class, based on the code by Nicholas C. Zakas in the book JavaScript For Web Developers 
	 * @author Vule Nikolic <nvule@verat.net>
	 * @copyright 2007 Vule Nikolic <nvule@verat.net>
	 */
	
	// set reverse according to default_order
	this.bReverse = false;
	if(default_order != 'asc')
	{
		this.bReverse = true;
	}
	
	
	// default reverse 
	this.bDefReverse = this.bReverse;
	
	
	// default row class
	this.normClassName = norm_row_class;
	
	// alt row class
	this.altClassName = alt_row_class;
	
	
	// init table
	this.oTable = document.getElementById(table_id);
	if(!this.oTable)
	{
		alert('Invalid table id: ' + table_id);
		return false;
	}
	
	// init headers, index values of column headers
	this.aHeaders = new Array();
	
	this.HeaderCells = new Array();
	// should be tHead.rows[0], for this site it is tHead.rows[1]
	this.iHeadNum = this.oTable.tHead.rows[1].cells.length;
	
	for(i=0; i<this.iHeadNum; i++)
	{
		this.aHeaders[i] = this.bDefReverse;
		
		this.HeaderCells[i] = this.oTable.tHead.rows[1].cells[i];
	}
	
	
	SortTable.convert = function (sValue, sDataType) 
	{
		switch(sDataType) 
		{
			case 'int':
				return parseInt(sValue);
				break;
	
			case 'float':
				return parseFloat(sValue);
				break;
	
			case 'date':
				return new Date(Date.parse(sValue));
				break;
	
			default:
				return sValue.toString();
				break;
		}
	}
	
	
	this.generateCompareTRs = function (iCol, sDataType) 
	{
		return function compareTRs(oTR1, oTR2) 
		{
			var vValue1 = SortTable.convert(oTR1.cells[iCol].firstChild.nodeValue, sDataType);
			var vValue2 = SortTable.convert(oTR2.cells[iCol].firstChild.nodeValue, sDataType);
	
			if (vValue1 < vValue2) 
			{
				return -1;
			} 
			else if (vValue1 > vValue2) 
			{
				return 1;
			} 
			else 
			{
				return 0;
			}
		};
	}
	
	
	this.sortColumn = function (iCol, sDataType, header_index) 
	{
		var oTBody = sortTable.oTable.tBodies[0];
		var colDataRows = oTBody.rows;
		var aTRs = new Array;
		for (var i=0; i < colDataRows.length; i++) 
		{
		
			aTRs[i] = colDataRows[i];
		}
	
		aTRs.sort(this.generateCompareTRs(iCol, sDataType));
		if(this.aHeaders[iCol])
		{
			aTRs.reverse();
			
			this.HeaderCells[header_index].className = 'blueBg sortDesc';
		}
		else
		{
			this.HeaderCells[header_index].className = 'blueBg sortAsc';
		}
	
		this.aHeaders[iCol] =! this.aHeaders[iCol];

		// set other headers to default sort
		for(j=0; j<this.iHeadNum; j++)
		{
			if(j != iCol)
			{
				// skip current column
				this.aHeaders[j] = this.bDefReverse;
			}
			
			if(j != header_index)
			{
				this.HeaderCells[j].className = 'blueBg';	
			}
		}

		
		var oFragment = document.createDocumentFragment();
		for (var i=0; i < aTRs.length; i++) 
		{
			oFragment.appendChild(aTRs[i]);
			
			if(i % 2 == 0)
			{
				aTRs[i].className = this.normClassName;
			}
			else
			{
				aTRs[i].className = this.altClassName;
			}
		}
		
		oTBody.appendChild(oFragment);
		this.oTable.sortCol = iCol;
	}
}


function validate(ovo)
{
	var num = ovo.elements.length;
	
	for(var i=0; i<num; i++)
	{
		if(trim_string(ovo.elements[i].value) == '')
		{
			alert('Nedostaju Podaci!');
			return false;
		}
	}
	
	return true;
}


function sendLink(ovo)
{
	ovo.href = ovo.href + window.escape(document.title) + '&body=Ciao, naletoh na stranicu: ' + window.escape(document.title) + ' na adresi: ' + window.location.href + ' pa ako te zanima svrati. Pozdrav!';	

	return true;
}


function share(ovo)
{
	var site = ovo.className;
	if(site == '')
	{
		return false;
	}
	
	var url 		= '';
	var local_url	= window.encodeURIComponent(document.location.href);
	var title		= window.encodeURIComponent(document.title);
	
	
	switch(site)
	{
		case "stumble":
			url = 'http://www.stumbleupon.com/submit?url=' + local_url + '&title=' + title;
			break;
			
		case "delicious":
			url = 'http://del.icio.us/post?url=' + local_url + ';title=' + title;
			break;
			
		case "digg":
			url = 'http://digg.com/submit?phase=2&url=' + local_url + '&title=' + title;
			break;
			
		case "reddit":
			url = 'http://reddit.com/submit?url=' + local_url;
			break;
			
		case "technorati":
			url = 'http://technorati.com/faves?add=' + local_url;
			break;
			
		case "magnolia":
			url = 'http://ma.gnolia.com/bookmarklet/add?url=' + local_url;
			break;
			
		case "facebook":
			url = 'http://www.facebook.com/sharer.php?u=' + local_url + '&t=' + title;
			break;
			
		case "linkedin":
			url = 'http://www.linkedin.com/shareArticle?mini=true&url=' + local_url + '&title=' + title + '&source=Kursna-Lista-Site';
			break;
			
		case "twitter":
			url = 'http://twitter.com/home?status=Jeste+videli+ovo+' + local_url;
			break;
		
		default:
			break;
	}
	
	if(url != '')
	{
		ovo.href = url;
		return true;
	}
	
	return false;
}

-->