
 /****************************************************************************\
 # Creation date :-> 28-03-2008 [dd-mm-yyyy]                                  #
 # Last update   :-> 16-03-2009 [dd-mm-yyyy]                                  #
 #                                                                            #
 # Author        :-> Antonio Magdic  <antonio@eburza.hr>                      #
 \****************************************************************************/

	function ChangeFontSize(mySize) {
		document.body.style.fontSize = mySize + "px";
		CreateCookie('FontSize', mySize, 14);
		
		$('myFontSize11').className = "";
		$('myFontSize12').className = "";
		$('myFontSize14').className = "";
		$('myFontSize15').className = "";
		
		$('myFontSize'+mySize).className = "selected";
	} // end of the 'ChangeFontSize()' function

	function CreateCookie(name, value, days) {
		if(days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	} // end of the 'CreateCookie()' function

	function ReadCookie(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	} // end of the 'ReadCookie()' function

	function EraseCookie(name) {
		CreateCookie(name, "", -1);
	} // end of the 'EraseCookie()' function
	
	function FeedCalendar(year, month) {
		var objID = 'FeedCalendar';
		var myAjax = new Ajax.Updater({	success: objID },	'include/calendar.php', {
				method: 'get',
				parameters: 'year='+year+'&month='+month,
				onFailure: reportError
			 }
		);
	} // end of the 'FeedCalendar()' function
	
	function FeedCalendarDate(year, month, day) {
		var myAjax = new Ajax.Request('include/calendar_date.php', {
				method: 'get',
				parameters: 'year='+year+'&month='+month+'&day='+day,
				onFailure: reportError
			}
		);
		
		// update feed calendar
		FeedCalendar(year, month);
		
		// reload
		setTimeout('window.location.reload();', 1000);
	} // end of the 'FeedCalendarDate()' function
	
	function DailyNews(myAction, objID) {
		var myAjax = new Ajax.Request('include/daily_news.php', {
				method: 'get',
				parameters: 'action='+myAction+'&object='+objID,
				onFailure: reportError
			}
		);
		
		DailyNewsMark(objID);
	} // end of the 'DailyNews()' function
	
	function DailyNewsMark(myAction) {
		var objID = "day"+myAction;
		for(i=1; i<5; i++) {
			if(i != myAction) {
				$('day'+i).className = 'day_news_off';
			}
		}
		
		if($(objID).className == 'day_news_off') {
			$(objID).className = 'day_news_on';
			//window.location.reload();
		} else {
			$(objID).className = 'day_news_off';
		}
		
		setTimeout('window.location.reload();', 1000);
	} // end of the 'DailyNewsMark()' function
		
	function StarFeed(rate, feed, uid) {
		var objID = 'stars_'+feed;
		var myAjax = new Ajax.Updater({	success: objID },	'include/star_feed.php', {
				method: 'post',
				parameters: 'feed='+feed+'&uid='+uid+'&rate='+rate,
				onFailure: reportError
			 }
		);
	} // end of the 'StarFeed()' function
	
	function myBookmark(feed, myAction) {
		var objID = 'FeedBookmark'+feed;
		var myAjax = new Ajax.Updater({	success: objID },	'include/bookmark.php', {
				method: 'post',
				parameters: 'feed='+feed+'&action='+myAction,
				onFailure: reportError
			 }
		);
	} // end of the 'myBookmark()' function
	
	function ArticleSave(article_id) {
		var objID = 'save_'+article_id;
		var myAjax = new Ajax.Updater({	success: objID },	'include/article_save.php', {
				method: 'post',
				parameters: 'action='+article_id,
				onFailure: reportError
			}
		);
	} // end of the 'ArticleSave()' function
	
	function ArticleChat(cache_id) {
		var Comment = prompt(AddCommentText, "");
		if(Comment != null) {
			var objID = 'Comments';
			var myAjax = new Ajax.Request('include/send_chat_data.php', {
					method: 'post',
					parameters: 'message=' + encodeURIComponent(Comment) + '&cache_id=' + cache_id,
					onFailure: reportError
				 }
			);
		}
		
		// update comments
		setTimeout("ArticleChatUpdate("+cache_id+")", 800);
	} // end of the 'ArticleChat()' function
	
	function ArticleChatUpdate(cache_id) {
		var objID = 'Comments';
		var myAjax = new Ajax.Updater({	success: objID },	'include/get_comments.php', {
				method: 'post',
				parameters: 'cache_id=' + cache_id,
				onFailure: reportError
			 }
		);
	} // end of the 'ArticleChatUpdate()' function
	
	function SubmitOnEnter(myForm, e) {
		if (!e) var e = window.event
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;
		
		if(code == 13) {
			myForm.submit();
		}
	} // end of the 'SubmitOnEnter()' function
	
	function CheckUsername(myValue) {
		var myAjax = new Ajax.Updater({	success: 'CheckUsername' },	'include/check_username.php', {
				method: 'post',
				parameters: 'value='+encodeURIComponent(myValue),
				onFailure: reportError
			 }
		);
	} // end of the 'CheckUsername()' function
	
	function CheckEmail(myValue) {
		var myAjax = new Ajax.Updater({	success: 'CheckEmail' },	'include/check_email.php', {
				method: 'post',
				parameters: 'value='+encodeURIComponent(myValue),
				onFailure: reportError
			 }
		);
	} // end of the 'CheckEmail()' function
	
	function SearchDelete(mySearch, myID) {
		var is_confirmed = confirm(SearchDeleteText+mySearch+'?');
		if(is_confirmed) {
			myID = 'search_tag_' + myID;
			var myAjax = new Ajax.Updater({	success: myID },	'include/search_delete.php', {
				method: 'post',
				parameters: 'search='+encodeURIComponent(mySearch),
				onFailure: reportError
			 }
		);
		}
	} // end of the 'SearchDelete()' function
	
	function ChatDelete(myChat) {
		var is_confirmed = confirm(ChatDeleteText);
		if(is_confirmed) {
			var myAjax = new Ajax.Request('include/chat_delete.php', {
					method: 'post',
					parameters: 'chat='+myChat,
					onFailure: reportError
				 }
			);
		}
	} // end of the 'ChatDelete()' function
	
	function StoryDelete(myStory) {
		var is_confirmed = confirm(StoryDeleteText);
		if(is_confirmed) {
			document.myForm.story_id.value = myStory;
			document.myForm.submit();
		}
	} // end of the 'StoryDelete()' function
	
	function DeleteBanner(myBanner) {
		var is_confirmed = confirm(BannerDeleteText);
		if(is_confirmed) {
			document.myForm.banner_id.value = myBanner;
			document.myForm.submit();
		}
	} // end of the 'DeleteBanner()' function
	
	function DeleteUserFeed(myFeed) {
		var is_confirmed = confirm(FeedDeleteText);
		if(is_confirmed) {
			document.MyFeedsForm.user_feed_id.value = myFeed;
			document.MyFeedsForm._action_.value = "delete_feed_user";
			document.MyFeedsForm.submit();
		}
	} // end of the 'DeleteUserFeed()' function
		
	function EditUserFeed(myFeed) {
		document.MyFeedsForm.user_feed_id.value = myFeed;
		document.MyFeedsForm._action_.value = "edit_feed_user";
		document.MyFeedsForm.action = "my_feed_edit.htm";
		document.MyFeedsForm.submit();
	} // end of the 'EditUserFeed()' function
	
	function reportError() {
		alert('The requested URL was not found on this server.');
	} // end of the 'reportError()' function

	function myNoteSave(uid, note) {
		var myAjax = new Ajax.Request('include/save_note.php', {
				method: 'post',
				parameters: 'uid='+uid+'&note='+encodeURIComponent(note),
				onFailure: reportError
			}
		);
	} // end of the 'myNoteSave()' function
	
	function RadioPopup(url) {
		var width  = 620;
		var height = 380;
		var left   = (screen.width  - width)/2;
		var top    = (screen.height - height)/2;
		var params = 'width='+width+', height='+height;
		params += ', top='+top+', left='+left;
		params += ', directories=no';
		params += ', location=no';
		params += ', menubar=no';
		params += ', resizable=no';
		params += ', scrollbars=no';
		params += ', status=no';
		params += ', toolbar=no';
		radio_win = window.open(url,'Radio', params);
		if (window.focus) {radio_win.focus()}
		return false;
	} // end of the 'RadioPopup()' function
	
	function CreateBookmarkLink() {
		if (window.sidebar) { // Mozilla Firefox Bookmark
			window.sidebar.addPanel(WebTitle, WebURL, "");
		} else if(window.external) { // IE Favorite
			window.external.AddFavorite(WebURL, WebTitle); 
		}	else if(window.opera && window.print) { // Opera Hotlist
			return true;
		}
	} // end of the 'CreateBookmarkLink()' function
	
	function HideFloatBanner(myTime) {
		setTimeout("$('FloatBanner').style.display='none'", myTime);
	} // end of the 'HideFloatBanner()' function