
/* 
      erzeugt am 15.02.2012 18:00:02
*/
function init() {
}

function setBookmark() {

	var bookmarkurl = location.href;
	var text = document.title;

	text = text.replace(/:/ ,"");
	text = text.replace(/\*/ ,"");
	text = text.replace(/\?/ ,"");
	text = text.replace(/\\/ ,"");
	text = text.replace(/"/ ,"");
	text = text.replace(/|/ ,"");

	if (window.sidebar) { // Mozilla Firefox Bookmark
	window.sidebar.addPanel(text, bookmarkurl,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( bookmarkurl, text); 
	} else if(window.opera && window.print) { // Opera Hotlist
		return true; 
	}  
}

//Hilfsfunktion um die Platzhalter zu ersetzen
String.format = function( text )  {
    //check if there are two arguments in the arguments list
    if ( arguments.length <= 1 )  {
        //if there are not 2 or more arguments there?s nothing to replace
        //just return the original text
        return text;
    }
    
    //decrement to move to the second argument in the array
    var tokenCount = arguments.length - 2;
    for( var token = 0; token <= tokenCount; token++ )    {
        //iterate through the tokens and replace their placeholders from the original text in order
        text = text.replace( new RegExp( "\\{" + token + "\\}", "gi" ),
                                                arguments[ token + 1 ] );
    }
    
    return text;
};


function bookmarkMe(link,  linkURL)  {

        linkURL = String.format( linkURL, encodeURIComponent(location.href), encodeURIComponent(document.title)  );

        //Die neue URL setzen
        link.href = linkURL;
        return true;
 
}

