
// Default Value
// http://plugins.jquery.com/project/defaultvalue
(function($) {

	$.fn.defaultvalue = function() {

		// Scope
		var elements = this;
		var args = arguments;
		var c = 0;

		return(
			elements.each(function() {

				// Default values within scope
				var el = $(this);
				var def = args[c++];

				el.val(def).focus(function() {
					if(el.val() == def) {
						el.val("");
					}
					el.blur(function() {
						if(el.val() == "") {
							el.val(def);
						}
					});
				});

			})
		);
	}
})(jQuery)

// initialise plugins
// Jquery Superfish
jQuery(function(){
	jQuery('ul.sf-menu').superfish();
});

$(document).ready(function() {
	
	
	
  // toggles the KBA-Schein Alt
  $('a#togglealt').click(function() {
  	$('#kbaneu').hide();
    $('#kbaalt').toggle(400);
    return false;
  });
  
  // toggles the KBA-Schein Neu
  $('a#toggleneu').click(function() {
  	$('#kbaalt').hide();
    $('#kbaneu').toggle(400);
    return false;
  });

});


  var futura = {
    src: 'futura.swf'
    ,ratios: [7,1.32,11,1.31,13,1.24,14,1.25,19,1.23,27,1.2,34,1.19,42,1.18,47,1.17,48,1.18,69,1.17,74,1.16,75,1.17,1.16]
  };
  // You probably want to switch this on, but read <http://wiki.novemberborn.net/sifr3/DetectingCSSLoad> first.
 sIFR.useStyleCheck = true;
sIFR.activate(futura);
			
sIFR.replace(futura, {
	selector: 'h2,h2.small,.futuraTopic', forceSingleLine: true, fitExactly: true, offsetLeft: 0, offsetTop: 0, tuneHeight: -5,
	css: ['.sIFR-root { color:#FFFFFF; text-transform: uppercase; letter-spacing: 0.6; text-decoration: none; }'],
	wmode: 'transparent'
});		


// XT-Commerce Stuff
var selected;
var submitter = null;

function submitFunction() {
    submitter = 1;
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=580,screenX=150,screenY=150,top=150,left=150')
}  
function popupFenster(url,width,height) {
	  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+width+',height='+height+',screenX=100,screenY=100,top=100,left=100')
}  

function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.getElementById('payment'[0])) {
    document.getElementById('payment'[buttonSelect]).checked=true;
  } else {
    //document.getElementById('payment'[selected]).checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function popupImageWindow(url) {
  window.open(url,'popupImageWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}



function changeOptions(){
	var max = parseInt(window.prompt('Please type number of items to display:', jQuery.Autocompleter.defaults.max));
	if (max > 0) {
		$("#suggest1").setOptions({
			max: max
		});
	}
}

function changeScrollHeight() {
    var h = parseInt(window.prompt('Please type new scroll height (number in pixels):', jQuery.Autocompleter.defaults.scrollHeight));
    if(h > 0) {
        $("#suggest1").setOptions({
			scrollHeight: h
		});
    }
}

href_link ="/kbasuche.php"

function change_typ(tmphref){
	if (typeof tmphref != 'undefined') {
		if (tmphref != '') {
			if(tmphref.indexOf("?")!=-1) {
				tmphref = tmphref.split("?")[0];
			}
			href_link =	tmphref;
		}
	}
	typnr = document.modellsuche.typ.options[document.modellsuche.typ.selectedIndex].value;
	document.location.href = href_link+"?typid="+typnr;
}

function change_hersteller(tmphref){
	if (typeof tmphref != 'undefined') {
		if (tmphref != '') {
			if(tmphref.indexOf("?")!=-1) {
				tmphref = tmphref.split("?")[0];
			}
			href_link =	tmphref;
		}
	}
	hernr = document.modellsuche.hersteller.options[document.modellsuche.hersteller.selectedIndex].value;
	href_link = href_link+"?hernr="+hernr;
	document.location.href = href_link;	
}

function change_modell(tmphref){
	if (typeof tmphref != 'undefined') {
		if (tmphref != '') {
			if(tmphref.indexOf("?")!=-1) {
				tmphref = tmphref.split("?")[0];
			}
			href_link =	tmphref;
			
			
		}
	}
	modnr = document.modellsuche.modell.options[document.modellsuche.modell.selectedIndex].value;
	href_link = href_link+"?modnr="+modnr;
	document.location.href = href_link;	
}