/* <[CDATA[ */
/* DickNick.de Syndication Code Copyright (c) 2007 by nb / www.webarbyte.de */
//dicknick_org_error_handler = window.onerror; 
//window.onerror = function() { return true; }
//window.status = 'DickNick.de';

var DickNick = {
	url : 'http://www.dicknick.de/syndication/v1/show.php',
	get : [],
	/// [ width, height ]
	formats : [
		[ 160, 300 ]
//		[ 160, 600 ],
//		[ 336, 280 ],
//		[ 728, 90 ],
//		[ 468, 60 ]
	],
	width : -1,
	height : -1,

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

//		this.AddParam( 'partner_id', window.dicknick_partner_id, '?' );
		this.AddParam( 'gender', window.dicknick_gender, '?' );
		this.AddParam( 'format', window.dicknick_format );
		this.AddParam( 'color_border', window.dicknick_color_border );
		this.AddParam( 'color_bg', window.dicknick_color_bg );
		this.AddParam( 'color_font', window.dicknick_color_font );
		this.AddParam( 'color_link', window.dicknick_color_link );
//		this.AddParam( 'width', this.width );
//		this.AddParam( 'height', this.height );
		this.AddParam( 'page_host', location.host );
		this.AddParam( 'page_url', location.href );
		this.AddParam( 'page_title', document.title );
		this.AddParam( 'page_referer', document.referer );
//		this.AddParam( 'cookie', document.cookie );
/// allowtransparency="true"
		document.write( '<' + 'iframe name="dicknick_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.dicknick_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 ) );
		}
	} 
}

/// init
/*
(
	function(){
		DickNick.Init();
	}
)();
*/

DickNick.Init();


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