/* Grobekelle Widget Syndication Code Copyright (c) 2008 by www.grobekelle.de */
// grobekelle_org_error_handler = window.onerror; 

var GrobekelleWidget = {
	url : 'http://syndication.grobekelle.de/widget/v1/frame.php',
	get : [],
	/// [ width, height ]
	formats : [
		[ 160, 560 ]
//		[ 160, 600 ],
//		[ 336, 280 ],
//		[ 728, 90 ],
//		[ 468, 60 ]
	],
	width : -1,
	height : -1,

	Init : function() {
		
		this.SetFormat();

		this.AddParam( 'order', window.gk_widget_order, '?' );
		this.AddParam( 'format', window.gk_widget_format );
		this.AddParam( 'color_border', window.gk_widget_color_border );
		this.AddParam( 'color_bg', window.gk_widget_color_bg );
		this.AddParam( 'color_font', window.gk_widget_color_font );
		this.AddParam( 'color_link', window.gk_widget_color_link );
		this.AddParam( 'category', window.gk_widget_category );
		this.AddParam( 'direction', window.gk_widget_direction );
		this.AddParam( 'page_host', location.host );
		this.AddParam( 'page_url', location.href );
		this.AddParam( 'page_title', document.title );
		this.AddParam( 'page_referer', document.referer );

		document.write( '<' + 'iframe name="grobekelle_widget_frame" vspace="0" hspace="0"  scrolling="no" marginheight="0" marginwidth="0" frameborder="0" width="' + this.width + '" height="' + this.height + '" src="' + this.url + '">' + '<' + '/iframe' + '>' );
	},

	SetFormat : function() {
		var format = parseInt( window.gk_widget_format );
		
		if( isNaN( format ) || ( format < 0 || format > this.formats.length ) ) {
			format = 0;
		}
		this.width = this.formats[ format ][ 0 ];
		this.height = this.formats[ format ][ 1 ];
	},

	AddParam : function( name, value, seperator ) {
		if( typeof seperator == 'undefined' ) {
			seperator = '&';
		}
		if( value ) {
			if( typeof value == 'object' ) {
				var count = value.length;
				var tmp = '';
				for( var k=0;k<count; k++ ) {
					tmp += this.Encode( value[ k ] );
					if( k < count-1 ) {
						tmp += ',';
					}
				}
				value = tmp;
			}
			else {
				value = this.Encode( value );
			}
		}
		else {
			value = '';
		}
		this.url += seperator + name + '=' + value;
	},
	
	Encode : function( data ) {
		if( typeof encodeURIComponent == 'function' ) {
			return( encodeURIComponent( data ) );
		}
		else {
			return( escape( data ) );
		}
	} 
}

GrobekelleWidget.Init();


//window.onerror = grobekelle_org_error_handler;
/* ]]> */