var currentPage = 0;
function forward(maxPages) {
	if (currentPage < maxPages) {
		currentPage++;
		$('page_count').update(currentPage+1);
		new Effect.MoveBy( 'scrollTable', 0, -383 , {duration: 0.4,  transition: Effect.Transitions.sinoidal});
	}
}
function backward() {
	if (currentPage > 0) {
		currentPage--;
		$('page_count').update(currentPage+1);
		new Effect.MoveBy( 'scrollTable', 0, 383 , {duration: 0.4,  transition: Effect.Transitions.sinoidal});
	}
}

function storeSearch() {
	var city = $F('filiale-city');
	var plz = $F('filiale-plz');
	var land = $F('filiale-land');
	var targeturl='http://www.kik-textilien.com/filialsuche.php?lang0=de&zip0='+plz+'&city0='+city+'&country0='+land;
	window.open(targeturl,'popup','width=590,height=700,left=50,top=50,scrollbars=1');
}

var flag = false;
function open_IMG(quelle) {
  if(typeof obj == 'undefined') {
    obj = new Image();
    obj.onload = function() { write_Popup(this); }
    obj.onerror = function() { alert(this.src + " konnte nicht geladen werden."); }
  }
  obj.src = quelle;
  return flag;
}
function write_Popup(bObj) {
  var w = bObj.width + 30;
  var h = bObj.height + 80;
  //var title = bObj.src.substring(bObj.src.lastIndexOf("/")+1, bObj.src.length);
  var pWin = window.open("","Detailansicht","left=0,top=0,width="+w+",height="+h+",menubar=no,status=no,scrollbars=yes");
  if(typeof pWin == 'undefined' || pWin == null) {
    alert("Ihr Browser erlaubt das Oeffnen von Popup-Fenstern nicht.");
  }
  else {
    pWin.resizeTo(w, h);
    pWin.document.open("text/html");
    pWin.document.write("<html><head><title>KiK Textilien & Non-Food GmbH<\/title><style type='text/css'>body{margin:0px;}<\/style><\/head><body style='background-color:white'>");
    pWin.document.write("<table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'>");
    pWin.document.write("<tr><td align='center'><a href='#' onClick='self.close();'><img border='0' src='"+bObj.src+"' width='"+bObj.width+"' height='"+bObj.height+"'><\/a><\/td><\/tr>");
    pWin.document.write("<\/table><\/body><\/html>");
    pWin.document.close();
    pWin.focus();
  }
}

function popup(url, winw, winh){
	settings="width="+winw+",height="+winh+",top="+((screen.availHeight/2)-(winh/2))+",left="+((screen.availWidth/2)-(winw/2))+",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no,dependent=no";
	win=window.open(url,"",settings);
	win.focus();
}

function popup2(url, winw, winh){
	settings="width="+winw+",height="+winh+",top="+((screen.availHeight/2)-(winh/2))+",left="+((screen.availWidth/2)-(winw/2))+",scrollbars=yes,location=no,directories=no,status=no,menubar=yes,toolbar=no,resizable=yes,dependent=no";
	win=window.open(url,"",settings);
	win.focus();
}