
function externallinks()
{
	var c=document.getElementById('content');
	if(c)
	{
		var ls=c.getElementsByTagName('a');
		for(var i=0;i<ls.length;i++){
			if(ls[i].getAttribute('rel')=='external')
			{
				ls[i].className+=ls[i].className?' extlink':'extlink';
				ls[i].title+='(opens in new window)';
				ls[i].onclick=function(){window.open(this.href);return 
false}
			}
		}
	}
}
function rotateImg(side,imgid,small){
		datos = "side="+side+"&imgid="+imgid+"&small="+small;
		var date = new Date();
		var timestamp = date.getTime();
		$.ajax({
		   type: "POST",
		   url: "/rotateimage.php?t="+timestamp,
		   data: datos,
		   beforeSend: function(){
		   	$("#loading").show();
			},
		   success: function(data){
		   		if(small > 1){
		   			//parent = $("#imgToRotate").parent();
		   			//$("#imgToRotate").remove();
		   			//parent.append('<img id="imgToRotate" class="image" hspace="5" border="0" vspace="5" alt="" src="'+data+'"/>');
		   			$("#imgToRotate_"+imgid).attr("src",data);
		   			$("#loading").hide();
				}else{
					rotateImg(side,imgid,2);
				}
		  }
		});	
}
function rssBlog(){
		datos = "action=getRssBlog";
		var date = new Date();
		var timestamp = date.getTime();
		$.ajax({
		   type: "POST",
		   url: "/ajax.php?t="+timestamp,
		   data: datos,
		   beforeSend: function(){
			},
		   success: function(data){
			$("#yellowbox-list-blog").html(data);
		  }
		});	
}
$(document).ready(function() {	
	//rssBlog();					   
	if(!document.getElementById && !document.createTextNode){return;}
	externallinks();
	
	if($('#checkbox').length) {
	$("#checkbox").click(function()	{
		var checked_status = this.checked;
		$("input[@type='checkbox']").each(function()
		{
			this.checked = checked_status;
		});
	});
	}
	/*$(".iconView").mouseover(function(){
		$("#socialName").text("Bookmarken bei " + $(this).attr("toshow"));
	});
	$(".iconView").mouseout(function(){
		$("#socialName").text("Bookmarken bei...");
	});*/
	$(".underOver").mouseover(function(){
		$(this).css("text-decoration","underline");
	})
	$(".underOver").mouseout(function(){
		$(this).css("text-decoration","none");
	})
});
function goBM(was) {
	sburl=encodeURIComponent(location.href);
	sbtitle=encodeURIComponent(document.title);
	switch(was) {	
		case 'facebook':
			window.open('http://www.facebook.com/sharer.php?u='+sburl+'&t='+sbtitle);
			break;
		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 '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 'google': 		
			window.open('http://www.google.com/bookmarks/mark?op=add&hl=de&bkmk='+sburl+'&title='+sbtitle);
			break;	
		default: 		
			window.open(was);
			break;

	}
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function disableDefault(){
	event.returnValue = false;
	return false;
}
/*
function goUrlPag(obj){
	var ppp = $(obj).attr("ppp");
	if(jQuery.url.param("ppp")){
		var pageAc = jQuery.url.param("page");
		var antPPP = jQuery.url.param("ppp");
		var theUrl = jQuery.url.attr("path")+"?"+jQuery.url.attr("query").replace("ppp="+antPPP,"ppp="+ppp).replace("page="+pageAc,"page=1");;
	}else{
		var theUrl = jQuery.url.attr("path")+"?"+jQuery.url.attr("query")+"&ppp="+ppp;	
	}
	location.href = theUrl;
}
*/
function goUrlPag(obj){
	var ppp = obj.options[obj.selectedIndex].value;
	
	if(jQuery.url.param("ppp")){
		var pageAc = jQuery.url.param("page");
		var antPPP = jQuery.url.param("ppp");
		var theUrl = jQuery.url.attr("path")+"?"+jQuery.url.attr("query").replace("ppp="+antPPP,"ppp="+ppp).replace("page="+pageAc,"page=1");;
	}else{
		var theUrl = jQuery.url.attr("path")+"?"+jQuery.url.attr("query")+"&ppp="+ppp;	
	}
	location.href = theUrl;
}
function filterProductsList(val){
	datos = "q="+val;
	var date = new Date();
	var timestamp = date.getTime();
	$.ajax({
	   type: "POST",
	   url: "/userbrowselistingsajax.php?t="+timestamp,
	   data: datos,
	   beforeSend: function(){
	   	$("#filterListings").attr("disabled","disabled");
		},
	   success: function(data){
	   	if(data != ""){
			$(".dataItems").remove();
			$(".titleItems").after(data);	
			$("#filterListings").attr("disabled","");
			if(val == ""){
				$(".pageNav").show();
			}else{
				$(".pageNav").hide();
			}
		}
	  }
	});		
}

/*
 * jQuery Impromptu
 * By: Trent Richardson [http://trentrichardson.com]
 * Version 1.5
 * Last Modified: 3/31/2008
 * 
 * Copyright 2008 Trent Richardson
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
jQuery.extend({	
	ImpromptuDefaults: { prefix:'jqi', buttons:{ Ok:true }, loaded:function(){}, submit:function(){return true;}, callback:function(){}, opacity:0.6, zIndex: 999, overlayspeed:'slow', promptspeed:'fast', show:'show', focus:0, useiframe:false },
	SetImpromptuDefaults: function(o){ 
		jQuery.ImpromptuDefaults = jQuery.extend({},jQuery.ImpromptuDefaults,o);
	},
	prompt: function(m,o){
		o = jQuery.extend({},jQuery.ImpromptuDefaults,o);
		
		var ie6 = (jQuery.browser.msie && jQuery.browser.version < 7);	
		var b = jQuery(document.body);
		var w = jQuery(window);
		
		
		
		var msgbox = '<div class="'+ o.prefix +'box" id="'+ o.prefix +'box">';		
		if(o.useiframe && ((jQuery.browser.msie && jQuery('object, applet').length > 0) || ie6))//if you want to use the iframe uncomment these 3 lines
			msgbox += '<iframe src="javascript:;" class="'+ o.prefix +'fade" id="'+ o.prefix +'fade"></iframe>';
		else{ 
			if(ie6) $('select').css('visibility','hidden');
			msgbox +='<div class="'+ o.prefix +'fade" id="'+ o.prefix +'fade"></div>';
		}	
		msgbox += '<div class="'+ o.prefix +'" id="'+ o.prefix +'"><div class="'+ o.prefix +'container"><div class="'+ o.prefix +'close">X</div><div class="'+ o.prefix +'message">'+ m +'</div><div class="'+ o.prefix +'buttons" id="'+ o.prefix +'buttons">';
		jQuery.each(o.buttons,function(k,v){ msgbox += '<button name="'+ o.prefix +'button'+ k +'" id="'+ o.prefix +'button'+ k +'" value="'+ v +'">'+ k +'</button>'}) ;
		msgbox += '</div></div></div></div>';
		
		var jqib =b.append(msgbox).children('#'+ o.prefix +'box');
		var jqi = jqib.children('#'+ o.prefix);
		var jqif = jqib.children('#'+ o.prefix +'fade');

		var getWindowScrollOffset = function(){ 
			return (document.documentElement.scrollTop || document.body.scrollTop) + 'px'; 
		};		
		
		var getWindowSize = function(){ 
			var size = {
				width: window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth),
				height: window.innerHeight || (window.document.documentElement.clientHeight || window.document.body.clientHeight)
			};
			return size;
		};
		
		var ie6scroll = function(){ 
			jqib.css({ top: getWindowScrollOffset() }); 
		};
		
		var flashPrompt = function(){
			var i = 0;
			jqib.addClass(o.prefix +'warning');
			var intervalid = setInterval(function(){ 
				jqib.toggleClass(o.prefix +'warning');
				if(i++ > 1){
					clearInterval(intervalid);
					jqib.removeClass(o.prefix +'warning');
				}
			}, 100);			
		};		
		

		var escapeKeyClosePrompt = function(e){
			var kC = (window.event) ? event.keyCode : e.keyCode; // MSIE or Firefox?
			var Esc = (window.event) ? 27 : e.DOM_VK_ESCAPE; // MSIE : Firefox
			if(kC==Esc) removePrompt();
		};

		var positionPrompt = function(){
			var wsize = getWindowSize();
			jqib.css({ position: (ie6)? "absolute" : "fixed", height: wsize.height, width: "100%", top: (ie6)? getWindowScrollOffset():0, left: 0, right: 0, bottom: 0 });
			jqif.css({ position: "absolute", height: wsize.height, width: "100%", top: 0, left: 0, right: 0, bottom: 0 });
			jqi.css({ position: "absolute", top: "100px", left: "50%", marginLeft: ((((jqi.css("paddingLeft").split("px")[0]*1) + jqi.width())/2)*-1) });					
		};
		
		var stylePrompt = function(){
			jqif.css({ zIndex: o.zIndex, display: "none", opacity: o.opacity });
			jqi.css({ zIndex: o.zIndex+1, display: "none" });
		}
		
		var removePrompt = function(callCallback, clicked, msg){
			jqi.remove(); 
			if(ie6)b.unbind('scroll',ie6scroll);//ie6, remove the scroll event
			w.unbind('resize',positionPrompt);			
			jqif.fadeOut(o.overlayspeed,function(){
				jqif.unbind('click',flashPrompt);
				jqif.remove();
				if(callCallback) o.callback(clicked,msg);
				jqib.unbind('keypress',escapeKeyClosePrompt);
				jqib.remove();
				if(ie6 && !o.useiframe) $('select').css('visibility','visible');
			});
		}
		
		positionPrompt();
		stylePrompt();	

		//Events
		jQuery('#'+ o.prefix +'buttons').children('button').click(function(){ 
			var msg = jqi.children('.'+ o.prefix +'container').children('.'+ o.prefix +'message');
			var clicked = o.buttons[jQuery(this).text()];	
			if(o.submit(clicked,msg))				
				removePrompt(true,clicked,msg);
		});
		if(ie6) w.scroll(ie6scroll);//ie6, add a scroll event to fix position:fixed
		jqif.click(flashPrompt);
		w.resize(positionPrompt);
		jqib.keypress(escapeKeyClosePrompt);
		jqi.find('.'+ o.prefix +'close').click(removePrompt);
		
		//Show it
		jqif.fadeIn(o.overlayspeed);
		jqi[o.show](o.promptspeed,o.loaded);
		jqi.find('#'+ o.prefix +'buttons button:eq('+ o.focus +')').focus();//focus the default button
		return jqib;
	}	
});
textoMarq = "    Ersatzteile neu Ersatzteile gebraucht Ersatzteile original neu Ersatzteile Nachbau neu Ersatzteile original gebraucht Ersatzteile Nachbau gebraucht Nachbauteile neu Nachbauteile gebraucht Neuteile original Neuteile Nachbau Originalteile neu Originalteile gebraucht";

function mueveTexto(){
	if(document.getElementById('marquesinatxt') != null){
		textoMarq = textoMarq.substring(1, textoMarq.length) + textoMarq.charAt(0)
	
		document.getElementById('marquesinatxt').value = textoMarq;
	
		tiempo = setTimeout('mueveTexto()',100)
	}
}
//if(navigator.userAgent.toLowerCase().indexOf("mac")!=-1){
//	$("#yellowbox-list-blog").css("padding-left","25px");
//}