// JavaScript Document
// WWIS -

function bookmarkOver(text){if(text==''){text='&nbsp;';}else{text='&nbsp;<strong>'+text+'</strong>';}
return true;}
function bookmarkGo(gotoURL){sburl=encodeURIComponent(location.href);sbtitle=encodeURIComponent(document.title);switch(gotoURL){case'delicious':window.open('http://del.icio.us/post?url='+sburl+'&title='+sbtitle);break;case'wong':window.open('http://www.mister-wong.de/index.php?action=addurl&bm_url='+sburl+'&bm_description='+sbtitle);break;case'blinkList':window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description=&Url='+sburl+'&Title='+sbtitle);break;case'yahoo':window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+sburl+'&t='+sbtitle);break;case'yigg':window.open('http://yigg.de/neu?exturl='+sburl+'&exttitle='+sbtitle);break;case'furl':window.open('http://www.furl.net/storeIt.jsp?u='+sburl+'&t='+sbtitle);break;case'oneview':window.open('http://beta.oneview.de:80/quickadd/neu/addBookmark.jsf?URL='+sburl+'&title='+sbtitle);break;case'folkd':window.open('http://www.folkd.com/submit/page/'+sburl);break;case'linkarena':window.open('http://linkarena.com/bookmarks/addlink/?url='+sburl+'&title='+sbtitle+'&desc=&tags=');break;case'google':window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+sburl+'&title='+sbtitle);break;case'webnews':window.open('http://www.webnews.de/einstellen?url='+sburl+'&title='+sbtitle);break;case'stylehive':window.open('http://my.stylehive.com/authenticated/bookmark/add.htm?bookmark.url='+sburl);break;}
return false;}


/***********************/
/** EVENT - FUNCTION **/
/*********************/
/* Function um Freunde auf die Einladungslist zu schreiben, bzw. wieder zu löschen */
function invite (id, name)
{
	var username	= name;
	var code 		= id;
	$(id+'_new').remove();
	new Insertion.Bottom('inv_friends','<li id="'+id+'_old" onclick="unload(\''+id+'\',\''+name+'\')";><input name="gaeste[]" type="checkbox" value="'+id+'" checked> '+name+'</li>');
	// new Ajax.Request oder so ... in einem array speichern
}

function unload (id, name)
{
	var username	= name;
	var code 		= id;
	$(id+'_old').remove();
	new Insertion.Bottom('allfriends','<li id="'+id+'_new" onclick="invite(\''+id+'\',\''+name+'\')"; ><input name="gaeste[]" type="checkbox" value="'+id+'"> '+name+'</li>');
	
}
/* <- <- END EVENT */

function empf (id)
{
	var data = 'empf='+id;
	new Ajax.Request('http://www.wo-war-ich-schon.de/ajax.php',
	{
		method:	   		'post',
		asynchronous:	true,
		evalScripts:	true,
		parameters: 	data
	});
}

function del_empf(id)
{
	$('empf_'+id).remove();
	empf (id);
}


// BOXEN - LIMIT
function box_size()
{
	alert('123');
	/*var data 	= Form.serialize('boxSize_'+id);
		new Ajax.Updater('dragBox_'+id,'http://www.wo-war-ich-schon.de/ajax_boxes.php', 
									{
										method:			'post', 
										//onComplete: 	newCommentMsg,
										asynchronous:	true, 
										evalScripts:	true, 
										parameters: 	data
									}); 
*/
}

/* LOGIN FILLER */
function loginFillin()
{
						
	var loginmail = $('login_mail');
	if(loginmail.value == '') { loginmail.value = ' Benutzername' };
	loginmail.onblur = function() { if (this.value == '') {this.value = ' Benutzername'} };
	loginmail.onfocus = function() { if (this.value == ' Benutzername') {this.value = ''} };
	
	var loginpassword = $('login_password');
	if(loginpassword.value == '') { loginpassword.type = 'text'; loginpassword.value = ' Passwort'};
	loginpassword.onblur = function() { if (this.value == '') { this.type = 'text';this.value = ' Passwort' } };
	loginpassword.onfocus = function() { if (this.value == ' Passwort') {this.value = ''; this.type = 'password' } };
}

/* KATEGORIEN */

function katselect()
{			
	var kat = $('kat');
	kat.onchange = function() {
								var data = '?kat='+this.value;
								
								new Ajax.Updater('subKats','http://www.wo-war-ich-schon.de/ajax_kategorien.php',
								{
									method:	   		'post',
									asynchronous:	true,
									evalScripts:	true,
									parameters: 	data
								});
							};

}
