var docTitle = document.title;



function showHide(id){
	if (document.getElementById(id).style.display == "none")
		document.getElementById(id).style.display = "block";
	else
	document.getElementById(id).style.display = "none";
}

function outside(){
	alert("Du måste vara inloggad för att kunna använda denna funktion.");		
}
		
		
function hideNotice(){
	document.getElementById('notice').style.display = "none";
	new Ajax('/_action/notice.php', {
		method: 'get'
	}).request();


}

function poesi(){
	new Windoo({
	"type": "iframe",
	"url": "/poesiFrame",
	'width': 880,
	'height': 560,
	'positionAtCenter': true,
	'title': 'Kylskåpspoesi',
	'buttons': {
		'minimize': false,
		'maximize': false
	},
	'container': false,
	'resizable': false,
	'shadow': true
	})
	.show(true)
}
		

	function abuse(id,type){
		new Windoo({
		"type": "iframe",
		"url": "/_action/abuse.php?id="+id+"&type="+type,
		'width': 600,
		'height': 460,
		'effect': 'noeffect',
		'positionAtCenter': true,
		'title': 'Anmäl olämpligt material',
		'buttons': {
			'minimize': false,
			'maximize': false
		},
		'container': false,
		'resizable': false,
		'shadow': true
		})
		.show(true)

	}

function xupdateMonList(){

	var req = new Request.HTML({url:'/_action/bevakning_get.php', 
		onSuccess: function(html) {
			//Clear the text currently inside the results div.
			$('monList').set('text', '');
			//Inject the new DOM elements into the results div.
			$('monList').adopt(html);
		},
		//Our request will most likely succeed, but just in case, we'll add an
		//onFailure method which will let the user know what happened.
		onFailure: function() {
			$('monList').set('html', '<div class="data"><p>Det gick inte att hämta dina bevakningar.</p></div>');
		}
	});
	
	req.send();
	setTimeout("xupdateMonList();", 120000);

};




setTimeout("xupdateMonList();", 120000);


	


function friend(id){
		var request = new Request.JSON({
			url: '/_action/friend.php?id='+id,
			onComplete: function(friendFlip){
				if (friendFlip.status == 'off'){
					alert('Du är inte längre vän med ' + friendFlip.username);
					$('addFriend').set('html','Lägg till som vän').removeClass('busy');
					}
				else{
					alert('Du är nu vän med ' + friendFlip.username);
					$('addFriend').set('html','Ta bort som vän').removeClass('busy');
				}
			},
			onRequest: function(friendSend){
				$('addFriend').set('html','Vänta... skickar data...');
			}
		}).send();
}
		
		
		
	
function flashTitle(doFlash){
	if (doFlash!=null)
		setTimeout("flashTitle(true);", 2000);
	
	if (flashStatus == 0){
		document.title = "[nya aktiviteter] - geeloo.network v11";
		flashStatus = 1;
	}
	else {
		document.title = docTitle;
		flashStatus = 0;
	}


}



function resizeTextArea(txtBox){
	alert(txtBox);
	nCols = txtBox.cols;
	sVal = txtBox.value;
	nVal = sVal.length;
	nRowCnt = 1;

	for (i=0;i<nVal;i++)
	{ if (sVal.charAt(i).charCodeAt(0) == 13) { nRowCnt +=1; } }

	if (nRowCnt < (nVal / nCols)) { nRowCnt = 1 + (nVal / nCols); }
	txtBox.rows = nRowCnt;
} 


function addTagToInput(target,tag){

	if (document.getElementById(target).value.length >0)
		document.getElementById(target).value += ', '+tag;
	else
		document.getElementById(target).value = tag;

}


