﻿ var TimeToFade = 300.0;
var offset=1;
var isMoving=0;
var cid=0
var citems=0
var hersteller_id
var hersteller_name
var serien_id
var serien_name
var Modell_id
var Modell_name
var LastNavigationStep
var DirectLinks = new Array(0,0,0,0)
var inputModell1=0
var inputModell2=0
var inputProduct1=0
var inputProduct2=0
var IE7_PNG_SUFFIX = ".png";
var LastMoveElement
var LastMoveDetailsElement="details_textblock_1"
var details_info_slider_content
var fullPrice, cPrice
var actlPrice
var actlLZ=84
var RateCountActive=0
var sliderID
var movePimage=0
var movePimageX=0
var movePimageY=0
var movePimageS=0
var mY 
var mX
var mS 
var lastWheel
var dragElementID
var movePimageX_start
var movePimageY_start
var searchTXT
var stoploadnow
var loading=0
var mh
var prev
var moveDone = 0;
var MoveTimer
var cgtimer
var fadeSeriesTO
var mlbar
var AutoFadeAdvImgTimeOut
var linkLoad
var FotoID=6
var firstStartOk
var firstAjaxStartOk
var divMoving
var slideTab
var lastE
var lastE2
var FadeToBlack
var animateColorTimeout
var alreadyFetched = {};
var plot
var jetzt = new Date();
var flottyp
var options = {
	lines: { show: false, fill: true, fillColor: "rgba(230, 235, 251, 0.4)" },
	//points: { show: true },
	//lines: { show: false },
	//points: { show: false },
	bars: { 
		show: false, 
		barWidth: 40000000, 
		align: "center", 
		lineWidth: 1,
		fill: true,
		fillColor: { colors: [ { opacity: 0.6 }, { opacity: 0.5 } ] },
		horizontal: false
	},
	grid: { hoverable: true, clickable: true,  markings: weekendAreas },
	//xaxis: { tickDecimals: 0, tickSize: 1 },
	xaxis: { 
		mode: "time",
		timeformat: "%d %b"  
	},
	legend: {
    	labelBoxBorderColor: "#FFFFFF",
    	backgroundOpacity: 0
  	}
};
var data = [];
var hvmove = []
var ShowThumbMoves = []
var getnewrefjob
var checkactionsjob 
var checkactionslast
var RateDownFB

function showalternatives(e){
	e.href='javascript:void(0)';
	e.style.display="none"
	document.getElementById('details_block').style.opacity="0.1"
	if (document.getElementById('startmodels_block')){
		smoothScroll('startmodels_block',1,0)
		ShowProducts('SL',12,this,'','','');
	}else{
		msgbox("Leider finden sich zu diesem Modell keine Alternativen in unserem Shop.")
	}
	document.getElementById("details_block").FadeState=-2
	
	setTimeout("fade('details_block')",2000)
	
}

function getUserStatistic(){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getUserStatistic",1)
}


function loadblog(blogID,e){
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/html/ajax_blog_archive.asp?blogID=" + blogID,1)
}

function getProductVariantInfo(productID){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getProductVariantInfo&productID=" + productID,1)
}

function openPopup(url, width, height) {
	var options = 'location=no,menubar=yes,scrollbars=yes';
	if (parseInt(width) && parseInt(height)) options += ',width=' + width + ',height=' + height;
	return window.open(url, 'popup', options);
}

function createUploader(){            
   var uploader = new qq.FileUploader({
       element: document.getElementById('file-uploader-demo1'),
       action: '../shop/asp/ajax_fileupload.asp',
       //action: '/shop/gfx/products/fotos/non-reference',
       debug: false
   });           
}


function printilonexs(e,oid,step){
	if (e) LinkLoading(e)
	nachnahme=""
	datum=""
	von=""
	bis=""
		landnach=""
	if (document.getElementById("nachnahme")) nachnahme=document.getElementById("nachnahme").value
	if (document.getElementById("datum")) datum=document.getElementById("datum").value
	if (document.getElementById("von")) von=document.getElementById("von").value
	if (document.getElementById("bis")) bis=document.getElementById("bis").value
		if (document.getElementById("landnach")) landnach=document.getElementById("landnach").value
	document.getElementById("msgbox").href="..\\shop\\html\\popup_ilonexs.asp?step=" + step + "&oid=" + escape(oid) + "&nnbetrag=" + nachnahme + "&datum=" + datum + "&von=" + escape(von) + "&bis=" + escape(bis) + "&landnach=" + escape(landnach)
	$('#msgbox').trigger('click');
}
function vcbexport(e,oid,step){
	if (e) LinkLoading(e)
	document.getElementById("msgbox").href="..\\shop\\html\\popup_vcb.asp?step=" + step + "&oid=" + escape(oid)
	$('#msgbox').trigger('click');
}

function customerstatus(status,e){
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=customerstatus&status=" + escape(status),1)
}

function nextCallback(e){
	if (e) LinkLoading(e)
	addhistory ("callback.html")
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_kunden.asp?mode=callback')
}

function rightclick(ev,e,id,rid){	
	if (ev.button) button  = ev.button ;
	
	tooltipHTML="<span class=\"contextmenu\"><a href=\"#\" onclick=\"loadProductAsAdmin('" + id + "','','','','','',this)\">Produkt editieren</a><br>"
		tooltipHTML+="<span class=\"contextmenu\"><a href=\"#\" onclick=\"loadSelected(this)\">Ausgewählte Elemente editieren</a><br>"
		tooltipHTML+="<br><b>Auswahl:</b><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"selectproduct('" + id + "',this)\">Produkt ausw&auml;hlen</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"checkallproductsEnd('" + id + "','" + rid + "',this)\">bis zu diesem Produkt ausw&auml;hlen</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"checkallproducts(this,'" + rid + "')\">Auswahl umkehren</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"uncheckallproducts('" + rid + "',this)\">Auswahl aufheben</a><br>"
		tooltipHTML+="<br><b>Priorit&auml;t:</b><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"setPriorUp('" + id + "',1)\">Produkt global nach vorn</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"setPriorUp('" + id + "',2)\">Produkt Herstellerintern nach vorn</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"setPriorUp('" + id + "',3)\">Produkt Serieninintern nach vorn</a><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"setPriorUp('" + id + "',5)\">Produktpriorität zurücksetzen</a><br>"
		tooltipHTML+="<br><b>Preis editieren:</b><br>"
	tooltipHTML+="<a href=\"#\" onclick=\"masseditprice(this)\">Preis f&uuml;r Auswahl editieren</a><br></span>"
	
	if (button==2) {
			Tip(tooltipHTML, WIDTH,200,OFFSETY, -10,OFFSETX, -20,FOLLOWMOUSE,false,DURATION,30000,CLICKCLOSE,true,BGCOLOR,'#eeeeee',BORDERWIDTH,1,FADEIN,250,FADEOUT,250,BORDERCOLOR,'#999999')  	
	}
		
	//	UnTip()
}

function masssaveprice(e,ev){
	if((ev.keyCode==13) || (ev==1)){
		if (e) LinkLoading(e)
		auswahl=document.getElementById("auswahl").value
		amount=document.getElementById("amount").value
		if (amount=="") {
			msgbox("Bitte geben Sie einen Preis an bevor Sie speichern drücken","masseditprice(this)","hab ich verstanden, Entschuldigung.")
			return;
		}
		//msgbox("Werte werden geschrieben...","javascript:void(0)","ich warte geduldig...")
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=setmassproductprice&value=" + escape(amount) + "&auswahl=" + escape(auswahl),1)
	}
}

function masseditprice(e){
	e.href='javascript:void(0)';
	elCount=document.getElementById('display_area_content').getElementsByTagName('input').length
	pid=""
	for (i=0; i<elCount;i++){
		pv=document.getElementById('display_area_content').getElementsByTagName('input')[i].id
		py=document.getElementById('display_area_content').getElementsByTagName('input')[i].type
		pc=document.getElementById('display_area_content').getElementsByTagName('input')[i].checked
		if ((py=="checkbox") && (pc==true)) {
			tmp=document.getElementById(pv).value
				if (tmp.indexOf("PID_")!=-1) pid+=tmp.replace("PID_","") + ","
			}
		}
	document.getElementById("msgbox").href="..\\shop\\html\\popup_productpreis.asp?selected="+pid
	$('#msgbox').trigger('click');
}

function uncheckallproducts(id,e){
	e.href='javascript:void(0)';
	elCount=document.getElementById('models_block_middle_'+id).getElementsByTagName('input').length
	pid=""
	for (i=0; i<elCount;i++){
		pv=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].id
		py=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].type
		pc=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked
		if ((py=="checkbox")) {
			document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked=false
		}
	}
}

function checkallproductsEnd(cid,id,e){
	e.href='javascript:void(0)';
	elCount=document.getElementById('models_block_middle_'+id).getElementsByTagName('input').length
	pid=""
	start=0
	for (i=0; i<elCount;i++){
		pv=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].id
		py=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].type
		pc=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked
		if ((py=="checkbox")) {
			if ((pc==true) && (start==0)) start=1
			if (start==1) document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked=true
			if (pv==cid) start=-1
		}
	}
}

function selectproduct(id,e){
	e.href='javascript:void(0)';
	if (document.getElementById(id)) document.getElementById(id).checked=true
}

function senduserdatas(e){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=senduserdatas',0)
}

function rateninfo(e){
	e.href='javascript:void(0)';
	document.getElementById("msgbox").href="..\\shop\\html\\popup_shoppingcart_rateninfo.asp"
	setTimeout("$('#msgbox').trigger('click');",50)
}

function mergecontacts(e){
	if (e) LinkLoading(e)
	elCount=document.getElementById('mergelist').getElementsByTagName('input').length
	pvlist=""
	for (i=0; i<elCount;i++){
		pi=document.getElementById('mergelist').getElementsByTagName('input')[i].id
		pt=document.getElementById('mergelist').getElementsByTagName('input')[i].type
		pv=document.getElementById('mergelist').getElementsByTagName('input')[i].value
		pc=document.getElementById('mergelist').getElementsByTagName('input')[i].checked
		
		if (pc==true) {
			pvlist=pvlist+pv+"|"
		}
	}
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=mergecontacts&pvlist='+pvlist,0)
}

function getcachestats(){
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getcachestats',0)
}

function sendFreundEmail(e){
	e.href='javascript:void(0)';
	cemail=document.getElementById("freund_email").value
	cname=document.getElementById("freund_name").value
	cartikel=document.getElementById("freund_artikel").value
	ueingabe=document.getElementById("user_eingabe").value
	
	if (cemail=="") {
		alert("Ihre Daten sind nicht vollständig\nBitte geben Sie Ihre eMail Adresse an")
		return
	}
	if (cname=="") {
		alert("Ihre Daten sind nicht vollständig\nBitte geben Sie Ihren Namen an")
		return
	}	
	email_Text =ueingabe
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendEmail&typ=11&email_artikel=" + cartikel + "&email_name=" + cname + "&email_Text="+ escape(email_Text)+"&email_Adresse="+ escape(cemail),1)
}

function sendadvise(pid,e){
	e.href='javascript:void(0)';
	document.getElementById("msgbox").href="..\\shop\\html\\popup_link_an_freund.asp?artikelID=" + pid
	setTimeout("$('#msgbox').trigger('click');",50)
}
function loginPopup(e){
	e.href='javascript:void(0)';
	document.getElementById("msgbox").href="..\\shop\\html\\popup_login.asp"
	setTimeout("$('#msgbox').trigger('click');",50)
}

function checkactions(){
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=checkactions',1)
}

function sendFeedback(e){
	if (e) LinkLoading(e)
	votename=document.getElementById("vote_name").value
	voteemail=document.getElementById("vote_email").value
	votejob=document.getElementById("vote_job").value
	votecompany=document.getElementById("vote_company").value
	votetext=document.getElementById("vote_text").value
	voterating=document.getElementById("vote_rating").value
  	votesa=document.getElementById("Shopauskunft").value
 	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendfeedback&vote_sa=' + votesa + '&vote_rating=' + voterating + '&vote_name=' + escape(votename) + '&vote_email=' + escape(voteemail) + '&vote_job=' + escape(votejob) + '&vote_company=' + escape(votecompany) + '&vote_text=' + escape(votetext),1)
}

function getnewref(){
	if (getnewrefjob) clearTimeout(getnewrefjob)
	lastrefid=document.getElementById("lastrefid").value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getnewref&lastrefid=' + escape(lastrefid),1)
}

function livesupport(e){
	e.href='javascript:void(0)';
	msgbox("Der LiveSupport befindet sich momentan noch in der Entwicklung. Bitte nutzen Sie unser Kontaktformular oder senden Sie uns eine eMail an info@uhrenlounge.de")
}

function myloungesave(e){
	if (e) LinkLoading(e)
	vorname=document.getElementById("vorname").value
	nachname=document.getElementById("nachname").value
	telefon=document.getElementById("telefon").value
	email=document.getElementById("email").value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=myloungesave&vorname=' + escape(vorname) + '&nachname=' + escape(nachname) + '&telefon=' + escape(telefon) + '&email=' + escape(email),1)
}

function myloungepassword(e){
	if (e) LinkLoading(e)
	uname=document.getElementById("username").value
	pword1=document.getElementById("password1").value
	pword2=document.getElementById("password2").value
	pword3=document.getElementById("password3").value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=myloungepassword&username=' + escape(uname) + '&password1=' + escape(pword1) + '&password2=' + escape(pword2) + '&password3=' + escape(pword3),1)

}

function removeadvsql(e,index){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=asrs&index=' + escape(index),1)
}

function advsearchaddsql(){
	v1=document.getElementById('select_eigenschaft').options[document.getElementById('select_eigenschaft').selectedIndex].value
	v2=document.getElementById('select_operator').options[document.getElementById('select_operator').selectedIndex].value
	v3=document.getElementById('select_wert').options[document.getElementById('select_wert').selectedIndex].value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=asas&v1=' + escape(v1) + '&v2=' + escape(v2) + '&v3=' + escape(v3))
}

function getdetailsearchfilter(e){
	selT=e.options[e.selectedIndex].text
	selV=e.options[e.selectedIndex].value
	document.getElementById('eigenschaft').innerHTML=selT
	selV=selV.split(".")
	tableName=selV[0]
	coloumnName=selV[1]
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=gdsf&tableName=' + escape(tableName) + '&coloumnName=' + escape(coloumnName))
}

function weekendAreas(axes) {
        var markings = [];
        var d = new Date(axes.xaxis.min);
        // go to the first Saturday
        d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
        d.setUTCSeconds(0);
        d.setUTCMinutes(0);
        d.setUTCHours(0);
        var i = d.getTime();
        do {
            // when we don't set yaxis, the rectangle automatically
            // extends to infinity upwards and downwards
            markings.push({ xaxis: { from: i, to: i + 1 * 24 * 60 * 60 * 1000 } });
            i += 7 * 24 * 60 * 60 * 1000;
        } while (i < axes.xaxis.max);

        return markings;
    }


function showTooltip(x, y, contents) {
	$('<div id="tooltip">' + contents + '</div>').css( {
	    position: 'absolute',
	    display: 'none',
	    top: y + 5,
	    left: x + 5,
	    border: '1px solid #fdd',
	    padding: '2px',
	    'background-color': '#fee',
	    opacity: 0.80
	}).appendTo("body").fadeIn(200);
}
		    
function get_data(e,ev,preserve) {	
	if (e) {
		if (e.getElementsByTagName('img')[0]){
			if (e.getElementsByTagName('img')[0].src=="http://" + document.location.host + "/shop/gfx/theme/disable.png") {
				e.getElementsByTagName('img')[0].src="http://" + document.location.host + "/shop/gfx/theme/enable.png"
			}else{
				e.getElementsByTagName('img')[0].src="http://" + document.location.host + "/shop/gfx/theme/disable.png"
			}
		}
	}
	if (preserve==undefined){
		document.getElementById("sel_date").innerHTML=""
		document.getElementById("top_sql").innerHTML="Bitte treffen Sie eine Auswahl"
	}
	elCount=document.getElementById('stat_1').getElementsByTagName('img').length
	typ=""
	opt=""
	for (i=0; i<elCount;i++){
		pv=document.getElementById('stat_1').getElementsByTagName('img')[i].id
		py=document.getElementById('stat_1').getElementsByTagName('img')[i].type
		pc=document.getElementById('stat_1').getElementsByTagName('img')[i].src
		if (pc=="http://" + document.location.host + "/shop/gfx/theme/enable.png") {
			if (pv.indexOf("flot")!=-1){
				tmp=pv.replace("flot","")
				typ+=tmp + ","
			}
			if (pv.indexOf("opt")!=-1){
				tmp=pv.replace("opt","")
				opt+=tmp + ","
			}
		}
	}
	
	//alert(typ)
	if (typ!=0) flottyp=typ
	ok=0
	if (!(ev)){
		ok=1
	}else{
		if (ev.keyCode==13) ok=1
	}
	if (ok==1){
		//if (e) LinkLoading(e)
		flot_day=document.getElementById("flot_day").value

		$.ajax({
			url: "../shop/asp/json.asp?preserve=" + preserve+ "&flot_day=" + flot_day + "&opt=" + opt + "&typ=" + flottyp,
			method: 'GET',
			dataType: "json",
			success: onDataReceived,
			error: ajaxError
		});
	}
} 

function ajaxError(textStatus){
	alert("data file corrupt / " + textStatus)
	
	tmpLL=linkLoad.innerHTML
	if (tmpLL) {
		tmpLLs=tmpLL.split("&nbsp; <IMG style")
		if (tmpLLs.length==1) tmpLLs=tmpLL.split("&nbsp; <img style")
		linkLoad.innerHTML=tmpLLs[0]
	}
	
}
  
function onDataReceived(series) {
	// extract the first coordinate pair so you can see that
	// data is now an ordinary Javascript object
	//var firstcoordinate = '(' + series.data[0][0] + ', ' + series.data[0][1] + ')';
	
	// let's add it to our current data
	var data = [];
	$.each(series, function(key) {
    	data.push(series[key]);
    });
	//data.push(series);
	
	// and plot all we got
	plot = $.plot($("#placeholder"), data, options);
	
	tmpLL=linkLoad.innerHTML
	if (tmpLL) {
		tmpLLs=tmpLL.split("&nbsp; <IMG style")
		if (tmpLLs.length==1) tmpLLs=tmpLL.split("&nbsp; <img style")
		linkLoad.innerHTML=tmpLLs[0]
	}
}

function addsqlflot(e,index,ref){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addsqlflot&index=' + index + "&ref=" + ref,1)
}

function getTopFlot(x,z){
	document.getElementById("top_sql").innerHTML="&nbsp; <img style='border:none' src='gfx/theme/loading_blue.gif'>"
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getTopFlot&index=' + x + '&Zeit=' + z,1)
}
  
function sendorderemail(e,oid,typ){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendorderemail&typ=' + typ + '&oid=' + oid,1)
}

function msgbox(txt,linkjob,linktxt,proof){
	txt=Encoder.htmlEncode(txt)
	txt=txt.replace("\n","<br>")
	txt=txt.replace("&#10;","<br>")
	txt=txt.replace("&lt;br&gt;","<br>")
	//check if fancybox is open
	//fbl=document.getElementById("fancybox-overlay").style.display
	//alert(fbl)
	if ((document.getElementById("fancybox-overlay").style.display=="block") && (proof==1)) {
		alert(txt)
	}else{
		document.getElementById("msgbox").href="..\\shop\\html\\popup_msgbox.asp?linktxt=" + linktxt + "&linkjob=" + linkjob + "&txt=" + escape(txt)
		setTimeout("$('#msgbox').trigger('click');",100)
	}
}

function cashhint(e,sump){
	if (e) e.href='javascript:void(0)';
	if (sump>=7000) Pidea=Math.round((sump*0.1)/50)*50
	if (sump<7000) Pidea=Math.round(((sump-4950)/50))*50
	if (sump<5000) Pidea=0
	document.getElementById("SQL_Anzahlung").value=Pidea
}

function stretchoffer(e,typ){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=saveoffer&id=' + e.id + '&gueltig=' + typ,1)
}

function changeofferprice(e,ev){
	e.style.color="maroon"
	if (ev.keyCode==13){
		//Preisangebot machen
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=saveoffer&id=' + e.id + '&preis=' + escape(e.value),1)
	}
}

function showstock(e){
	if (e) LinkLoading(e)
	addhistory ("onstock.html")
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_serien.asp?onstock=1')	
}

function requestdeliverytime(e,pid){
	if (e) e.href='javascript:void(0)';
	document.getElementById("hiddenclicker6").href="..\\shop\\html\\popup_requestdeliverytime.asp?pid=" + pid
	$('#hiddenclicker6').trigger('click');
}

function requestdeliverytimenow(e){
	e.href='javascript:void(0)';
	if (document.getElementById("AC_anrede")) anrede=document.getElementById("AC_anrede").innerHTML
	if (document.getElementById("AC_name")) name=document.getElementById("AC_name").value
	if (document.getElementById("AC_email")) email=document.getElementById("AC_email").value
	if (document.getElementById("AC_telefon")) telefon=document.getElementById("AC_telefon").value
	if (document.getElementById("AC_pid")) pid=document.getElementById("AC_pid").value
	
	if (document.getElementById("AC_name").value=="") {
		document.getElementById("LB_name").style.color="red"
		return;
	}
	if (document.getElementById("AC_email").value=="") {
		 document.getElementById("LB_email").style.color="red"
		 return;
	}
	if (document.getElementById("AC_telefon").value=="") {
		document.getElementById("LB_telefon").style.color="red"
		return;
	}
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=requestdeltime&id=" + pid + "&name="+ escape(name) + "&email="+ escape(email) + "&telefon="+ escape(telefon)+ "&anrede="+ escape(anrede),1)

}

function stopload(e){
	e.href='javascript:void(0)';
	stoploadnow=1
	parent.$.fancybox.close();
}

function startstoptask(e,eid){
	document.getElementById('display_area_content').style.opacity="0.7"
	e.href='javascript:void(0);'
	wid=document.getElementById('wid_'+eid).value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=startstoptask&wid=" + wid + "&eid=" + escape(e.id) + "&echeck=" + escape(e.checked),1)
}

function savemodellinfo(e,d,eid){
	document.getElementById('display_area_content').style.opacity="0.8"
	if((d.keyCode==13) || (d==1)){
		e.href='javascript:void(0);'
		document.getElementById('display_area_content').style.opacity="0.5"
		wid=document.getElementById('wid_' + eid).value
		tax=document.getElementById('select_tax_' + eid).value
		seriennummer=document.getElementById('seriennummer_' + eid).value
		if (seriennummer=="k.A.") seriennummer=""
		rechnungsnummer=document.getElementById('rechnungsnummer_' + eid).value
		rechnungsbetrag=document.getElementById('rechnungsbetrag_' + eid).value
		if (rechnungsnummer=="k.A.") rechnungsnummer=""
		pro_pay=document.getElementById('pro_pay_' + eid).value
		deliveryok=0
		if (document.getElementById('pro_pay_' + eid).checked==false) pro_pay=0
		if (document.getElementById('deliveryok_' + eid)) {
			if (document.getElementById('deliveryok_' + eid).checked==true) deliveryok=1
		}else{
			deliveryok=1
		}
		
		if (((tax==-1) || (seriennummer=="") || (rechnungsnummer=="")) && (deliveryok=="1")) {
			msgbox("bitte geben Sie die Seriennummer, Rechnungsnummer und Besteuerungsart an bevor Sie das Modell als eingegangen markieren.\nIhre &Auml;nderungen wurden nicht gespeichert.")
			document.getElementById('display_area_content').style.opacity="1"
			document.getElementById('deliveryok_' + eid).checked=false
			return;
		}
			
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=savemodellinfo&wid=" + wid + "&deliveryok=" + deliveryok + "&tax=" + escape(tax) + "&seriennummer=" + escape(seriennummer) + "&rechnungsbetrag=" + escape(rechnungsbetrag) + "&rechnungsnummer=" + escape(rechnungsnummer) + "&pro_pay=" + escape(pro_pay),1)
	}
}

function addproductcomment(e,d,wid){
	document.getElementById('display_area_content').style.opacity="0.8"
	if(d.keyCode==13){
		e.href='javascript:void(0)';
		document.getElementById('display_area_content').style.opacity="0.5"
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addproductcomment&comment=" + escape(e.value) + "&wid=" + escape(wid),1)
	}
}

function deletedocument(e,docname,orderID){
	LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=deletedocument&orderID=" + escape(orderID) + "&docname=" + escape(docname),1)
}


function createdocument(e,docname,orderID){
	LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=createdocument&orderID=" + escape(orderID) + "&docname=" + escape(docname),1)
}

function searchproduct(e,ev){
	if (ev.keyCode==13){
		document.getElementById('searchproduct_label').innerHTML="suche..."
		search=e.value
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=adminsearchproduct&typ="+ e.id +"&search=" + escape(search),1)
	}
}

function adminsaveshopconfig(e,ev){
	if (ev.keyCode==13){
		id=e.id
		value=e.value
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=adminsaveshopconfig&id=" + escape(id) + "&value=" + escape(value),1)
	}
}

function adminAddProduct(pid,e,typ){
	e.href='javascript:void(0)';
	if (typ=="suche_add_offer") addhistory ("admin_angebote.html")
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?typ=" + typ + "&action=adminaddproduct&pid=" + escape(pid),1)
}

function saveOrderDetails(e,oid){
	e.href='javascript:void(0)';
	e.innerHTML="Bitte warten..."
	zv=document.getElementById('select_zahlung').value
	lz=document.getElementById('select_laufzeit').value
	az=document.getElementById('anzahlung').value
	va=document.getElementById('select_versandart').value	
	exid=zv+"|"+va
	
	st=document.getElementById('select_Bestellstatus').value
	oldexid=document.getElementById('oldexid').value
	aid=document.getElementById('artikelID').value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=saveorderdetails&aid=" + aid + "&orderID=" + oid + "&oldexid=" + escape(oldexid) + "&exid=" + escape(exid) + "&lz=" + escape(lz) + "&az=" + escape(az) + "&st=" + escape(st),1)
}

function removeextra(e,exid,oid){
	LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=removextra&exid=" + escape(exid) + "&orderID=" + oid,1)

}

function checkZ(e,oid){
	document.getElementById(e.id.replace("select_","")).innerHTML=e.options[e.selectedIndex].text
	if (e.id=="select_extras") {
		if (e.options[e.selectedIndex].text.indexOf("---")!=-1) return;
		exid=e.options[e.selectedIndex].value
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addxtra&exid=" + escape(exid) + "&orderID=" + oid,1)
		return;
	}
	
	document.getElementById("saveOrderInfo").style.color="maroon"
	if (e.id=="select_zahlung") {
		if (e.options[e.selectedIndex].text.indexOf("Finanzierung")!=-1) {
			document.getElementById('li_lz').style.display='block'
			//document.getElementById('li_az').style.display='block'
		}else{
			document.getElementById('li_lz').style.display='none'
			//document.getElementById('li_az').style.display='none'	
		}
	}
}
function checkOrderPopupComment(ev,e,f,oid){
	e.href='javascript:void(0)';
	if ((((ev.keyCode==13) || (f==1))) && (document.getElementById("o_coment").value!="")){
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addordercomment&orderID=" + oid + "&comment=" + escape(document.getElementById("o_coment").value),1)	
	}
}

function setProductPrice(e,ev,pid){
	lastE2=e
	e.style.color="maroon"
	if (ev.keyCode==13) {
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=setproductprice&value=" + e.value + "&pid=" + escape(pid),1)
		e.value="edit..."
	}
}

function selectProduct(e,pid){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=selectproduct&status=" + e.checked + "&pid=" + escape(pid),1)
}

function setPriorUp(pid,typ){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=editprior&typ=" + typ + "&pid=" + escape(pid),1)
}


function slideNext(direction,fixedTab,e,HerstellerID,SerieID,ModellID){
	if ((slideTab=="") || (slideTab==undefined)) slideTab=0
	slideTab=slideTab+direction
	if (!(document.getElementById("slideTab_" + HerstellerID + SerieID + ModellID + "_" + slideTab))) {
		slideTab=slideTab-direction
		return;
	}
	
	if ((fixedTab!=undefined) && (fixedTab!='')) slideTab=fixedTab-1
		
	maxTab=1
	while (document.getElementById("fmore_" + HerstellerID + SerieID + ModellID + "_" +maxTab)){ 
		document.getElementById("fmore_" + HerstellerID + SerieID + ModellID + "_" + maxTab).style.fontWeight="normal"
		document.getElementById("fmore_" + HerstellerID + SerieID + ModellID + "_" + maxTab).style.fontSize="12px"
		maxTab++
	}
	maxTab--
	
	tmp=slideTab+1
	document.getElementById("fmore_" + HerstellerID + SerieID + ModellID + "_" + tmp).style.fontWeight="bold"
	document.getElementById("fmore_" + HerstellerID + SerieID + ModellID + "_" + tmp).style.fontSize="15px"
	
	leftpos=document.getElementById("fleft_" + HerstellerID + SerieID + ModellID).offsetLeft
	rightpos=(document.getElementById("fright_" + HerstellerID + SerieID + ModellID).offsetLeft-574)*-1

	if (tmp==1) { // am anfang das links verstecken
		tL = new Tween(document.getElementById("fleft_" + HerstellerID + SerieID + ModellID).style,'left',Tween.strongEaseInOut,leftpos,-117,1,'px');
		tL.start()	
	}else{
		if (leftpos!=0) {
			tL = new Tween(document.getElementById("fleft_" + HerstellerID + SerieID + ModellID).style,'left',Tween.strongEaseInOut,leftpos,0,1,'px');
			tL.start()	
		}
	}
	
	if (tmp==maxTab) { // am ende das rechts verstecken
		tR = new Tween(document.getElementById("fright_" + HerstellerID + SerieID + ModellID).style,'right',Tween.strongEaseInOut,rightpos,-117,1,'px');
		tR.start()	
	}else{
		if (rightpos!=0) {
			tR = new Tween(document.getElementById("fright_" + HerstellerID + SerieID + ModellID).style,'right',Tween.strongEaseInOut,rightpos,0,1,'px');
			tR.start()	
		}
	}

	e.href='javascript:void(0)';
	if (document.getElementById("slideTab_" + HerstellerID + SerieID + ModellID + "_" + slideTab).innerHTML.indexOf('ul')<0) {
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=loadmoreseries&slideTab=" + slideTab + "&HerstellerID=" + HerstellerID + "&SerieID=" + SerieID + "&ModellID=" + ModellID,1)
	}else{
		tmp=document.getElementById("models_block_middle_slide_" + HerstellerID + SerieID + ModellID).offsetLeft-20
		tmp2=slideTab*-670
		t1 = new Tween(document.getElementById("models_block_middle_slide_" + HerstellerID + SerieID + ModellID).style,'left',Tween.strongEaseInOut,tmp,tmp2,1.5,'px');
		t1.start()	
	}
}

function edit_haendler(e,haendlerID,herstellerID){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=edithaendler&typ=prio&status=" + e.checked + "&hersteller=" + escape(herstellerID) + "&haendler=" + escape(haendlerID),1)
}

function del_haendler(e,haendlerID,herstellerID){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=edithaendler&typ=del&hersteller=" + escape(herstellerID) + "&haendler=" + escape(haendlerID),1)
}

function add_haendler(e,id,herstellerID){
	document.getElementById(id).innerHTML=e.options[e.selectedIndex].text
	haendlerID=e.options[e.selectedIndex].value
	
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=edithaendler&typ=add&hersteller=" + escape(herstellerID) + "&haendler=" + escape(haendlerID),1)
}

function savetemplate(e){
	LinkLoading(e)
	input=document.getElementById("email_Text")
	input.focus();
    var start = input.selectionStart;
    var end = input.selectionEnd;
    if (start!=end) {
	    var template_text = input.value.substring(start, end);
	}else{
		var template_text = input.value
	}
	
	template_name=document.getElementById("add_template").value	
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addtemplate&name=" + escape(template_name) + "&text=" + escape(template_text),1)
}

function selectLand(id,e){
	document.getElementById(e.id+"2").innerHTML=e.options[e.selectedIndex].text
	document.getElementById(id).value=e.options[e.selectedIndex].value

	/*if (e.options[e.selectedIndex].text=="Deutschland"){
		document.Versandarten.Versand[0].checked = true
		document.getElementById("versand_D").style.display="block"
		document.getElementById("versand_EU").style.display="none"
	}else{
		document.Versandarten.Versand[3].checked = true
		document.getElementById("versand_D").style.display="none"
		document.getElementById("versand_EU").style.display="block"
	}*/
}

function CheckCalls(){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=checkCalls",1)
}

function callto(e,sessionID,nr){
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=callto&sessionID="+ sessionID,1)
	if (e) {
		e.target='call_target'
		e.href='SIP:' + nr;
	}
}

function switchTopImg(){
  		z1=document.getElementById('top_img1').style.zIndex  		
  		z2=document.getElementById('top_img2').style.zIndex
  		if (z1>=10){
  			z1=1
  			z2=0
  		}
  		if (z2>=10){
  			z2=1
  			z1=0
  		}
  		document.getElementById('top_img1').style.zIndex=z1		
  		document.getElementById('top_img2').style.zIndex=z2  		
  		
  		FotoID++
  		if (FotoID>5) FotoID=3
  		  		
  		
  		if (z2>z1) {
  			document.getElementById('top_img1').src="gfx/theme/silver_shop_top_image_" + FotoID + ".png"
  			setTimeout(function(){
  				document.getElementById('top_img1').style.opacity="0"
  				z2=(z2*1)+1*1
  				if (z2>10) z2=10
  				document.getElementById('top_img1').style.zIndex=z2
	  			var startMS = (new Date()).getTime();
	  			ChangeOpacity("top_img1",3000,startMS,0,100)
	  		},2000)
	  		setTimeout(function(){
	  			document.getElementById('top_img2').src=document.getElementById('top_img1').src
	  		},7000)
  		}else{		
  			document.getElementById('top_img2').src="gfx/theme/silver_shop_top_image_" + FotoID + ".png"
   			setTimeout(function(){
   				z1=(z1*1)+1*1
   				if (z1>10) z1=10
  				document.getElementById('top_img2').style.zIndex=z1
	  			document.getElementById('top_img2').style.opacity="0"	
	  			var startMS = (new Date()).getTime();
	  			ChangeOpacity("top_img2",3000,startMS,0,100)
	  		},2000)		
	  		setTimeout(function(){
	  			document.getElementById('top_img1').src=document.getElementById('top_img2').src	
	  		},7000)
	  	}
	  	
	  	setTimeout(switchTopImg,30000)
}
function deluser(e){
	box=window.confirm("Möchten Sie den Benutzer wirklich löschen?")
	if(box==true){ 
		if (e) LinkLoading(e)
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=deluser",1)
	}
}
function setKSaktiv(e,id){
	if (e) {
		status=e.innerHTML
		LinkLoading(e)
	}
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=setKS&id="+ id +"&status="+ status,1)
}

function hoverdetail(e,m){
	if (e){
		e.style.width="auto"
		tmp=e.offsetWidth
		if (m==1){
			if (tmp>100){
				e.style.width="95px"
				if (hvmove[e.id]) clearTimeout(hvmove[e.id])
				hovermove(e,95,210)
			}else{
				e.style.width="95px"
			}
		}else{
			if (hvmove[e.id]) clearTimeout(hvmove[e.id])
			hovermove(e,tmp,95)
		}
	}
}

function hovermove(e,w,mw){
	if (Math.abs(w-mw)<15) {
		e.style.width=mw + "px"
		return
	}
	if (w<mw) w=w+5
	if (w>mw) w=w-15
	e.style.width=w + "px"
	hvmove[e.id]=setTimeout(function(){
		hovermove(e,w,mw)
	},33)
}

function loadKS(e,ksyear){
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/html/ajax_Kundenstimmen.asp?year=" + ksyear)
}

function LinkLoading(e){
	e.href='javascript:void(0)';
	linkLoad=e
	e.innerHTML+="&nbsp; <img style='border:none' src='gfx/theme/loading_blue.gif'>"	
}

function modellquest(e,id){
	if (e) LinkLoading(e)
	addhistory ("Kontakt.html")
	URLRequest("http://www.uhrenlounge.de/shop/html/ajax_Kontakt.asp?pid=" + id)
}

function checkcode(e){
	if(e.keyCode==13){
		document.getElementById("gutschein_comment").innerHTML="Ihr Code ist nicht (mehr) gültig."
		ResizeDiv("Gutscheincode")
	}
}

function sendContactEmail(e){
	e.href='javascript:void(0)';
	cemail=document.getElementById("comment_email2").value
	cname=document.getElementById("comment_name2").value
	ctelefon=document.getElementById("comment_telefon2").value
	ueingabe=document.getElementById("user_eingabe").value
	
	if (ueingabe=="") {
		msgbox("Ihre Daten sind nicht vollständig\nBitte füllen Sie das Nachrichtenfeld mit Ihrer Nachricht aus.")
		return
	}
	if (cemail=="") {
		msgbox("Ihre Daten sind nicht vollständig\nBitte geben Sie Ihre eMail Adresse an")
		return
	}
	if (cname=="") {
		msgbox("Ihre Daten sind nicht vollständig\nBitte geben Sie Ihren Namen an")
		return
	}
	if (ctelefon=="") {
		msgbox("Ihre Daten sind nicht vollständig\nBitte geben Sie Ihre Telefonnummer an")
		return
	}		
	email_Text ="Anfrage von " + cname + " (" + cemail + ";" + ctelefon + "):<br>&oline;<br>" + ueingabe
	email_Betreff="Neue Frage über das Kontaktformular von " + cname
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendEmail&typ=2&email_telefon=" + ctelefon + "&email_name=" + cname + "&email_Betreff="+ escape(email_Betreff) +"&email_sender=" + escape(cemail) + "&email_Text="+ escape(email_Text)+"&email_Adresse="+ escape("info@uhrenlounge.de"),1)
}

function UserRegister(e){
	if (e) LinkLoading(e)
	register_email=document.getElementById("register_email").value
	register_name=document.getElementById("register_name").value
	register_telefon=document.getElementById("register_telefon").value

	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=userRegister&register_email="+ escape(register_email) +"&register_name=" + escape(register_name) + "&register_telefon="+ escape(register_telefon),1)

}

function send_eMail(e){
	if (e) LinkLoading(e)
	email_Adresse=document.getElementById("email_Adresse").value
	email_Text=document.getElementById("email_Text").value
	email_Betreff=document.getElementById("email_Betreff").value
	email_Attach=document.getElementById("email_Attach").value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendEmail&typ=1&email_Attach=" + escape(email_Attach) + "&email_Betreff="+ escape(email_Betreff) +"&email_sender=&email_Text="+ escape(email_Text)+"&email_Adresse="+ escape(email_Adresse),1)
}

function send_SMS(e){
	if (e) LinkLoading(e)
	nummer=document.getElementById("SMS_nummer").value
	text=document.getElementById("SMS_text").value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=sendSMS&sms_nummer="+ escape(nummer) +"&SMS_text="+ escape(text),1)
}

function doExport(e,job){
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/html/ajax_admin_vcbexport.asp?job="+ escape(job))
}

function addcostumernow(e,anrede,vorname,nachname,email,telefon,CallID){
	if (e) LinkLoading(e)
	if ((anrede==undefined) && (document.getElementById("AC_anrede"))) anrede=document.getElementById("AC_anrede").innerHTML
	if ((vorname==undefined) && (document.getElementById("AC_vorname"))) vorname=document.getElementById("AC_vorname").value
	if ((nachname==undefined) && (document.getElementById("AC_nachname"))) nachname=document.getElementById("AC_nachname").value
	if ((email==undefined) && (document.getElementById("AC_email"))) email=document.getElementById("AC_email").value
	if ((telefon==undefined) && (document.getElementById("AC_telefon"))) telefon=document.getElementById("AC_telefon").value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addcostumer&callID=" + CallID + "&vorname="+ escape(vorname) +"&nachname="+ escape(nachname) + "&email="+ escape(email) + "&telefon="+ escape(telefon)+ "&anrede="+ escape(anrede),1)
}

function moveLoadingBar(md){
	if (mlbar) clearTimeout(mlbar)
	if (md==1) document.getElementById("data0").getElementsByTagName('img')[0].style.left=0 + "px"
	if ((md==undefined) || (md==1)) md=5
	tmp=document.getElementById("data0").getElementsByTagName('img')[0].offsetLeft
	tmp=tmp+md
	if (tmp>125) md=-5 
	if (tmp<0) md=5
	document.getElementById("data0").getElementsByTagName('img')[0].style.left=tmp + "px"
	mlbar=setTimeout(function(){
		moveLoadingBar(md)
	},33)
}

function savePhotos(e){
	if (e) LinkLoading(e)
	e.onclick=""
	e.innerHTML="..."
	pid=document.getElementById("product_id").value
	info=""
	elCount=document.getElementById("assign_fotos").getElementsByTagName('input').length
	for (i=0; i<elCount;i++){
		pi=document.getElementById("assign_fotos").getElementsByTagName('input')[i].id
		pv=document.getElementById("assign_fotos").getElementsByTagName('input')[i].value
		pc=document.getElementById("assign_fotos").getElementsByTagName('input')[i].checked
		if (pi=="fotos") info+=pc + "|" + pv + "|"
	}
		
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=assignimage&pid="+ escape(pid) +"&info="+ escape(info),1)
}

function navback(e){
	if (e) LinkLoading(e)
	window.history.back()
	CheckForHash()
}

function loadArticle(e,pid){
	if (e) e.href='javascript:void(0)';
	if (isMoving==1) return
	lme=LastMoveElement.replace("pinfo_subcon_","")		
	document.getElementById('li_'+lme).getElementsByTagName('a')[1].innerHTML="+"
	HideDivMove(LastMoveElement,0,5)	
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=loadarticle&pid=" + pid,1)	
}

function getVariant(e,typ,pid){
	if (e) e.href='javascript:void(0)';
	if ((document.getElementById('pinfo_subcon_'+typ).isMoving==1) || (isMoving==1) || (document.getElementById('li_'+typ).getElementsByTagName('a')[1].innerHTML=="<img src=\"gfx/theme/loading_blue.gif\">"))	return
	if (LastMoveElement){
		lme=LastMoveElement.replace("pinfo_subcon_","")
		if ((LastMoveElement.indexOf("pinfo_subcon_")==0) && (LastMoveElement!='pinfo_subcon_'+typ)) {
			HideDivMove(LastMoveElement,0)	
			if ((lme=="zifferblatt") || (lme=="band")) document.getElementById('ainfo_subcon_'+lme).getElementsByTagName('span')[2].style.visibility="visible"
		}
		document.getElementById('li_'+lme).getElementsByTagName('a')[1].innerHTML="+"
	}
	
	if ((typ=="zifferblatt") || (typ=="band")) document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[2].style.visibility="hidden"
	
	LastMoveElement='pinfo_subcon_'+typ
	if (document.getElementById('pinfo_subcon_'+typ).innerHTML!=""){
		if (document.getElementById('pinfo_subcon_'+typ).style.display=="") document.getElementById('pinfo_subcon_'+typ).style.display="none"
		if (document.getElementById('pinfo_subcon_'+typ).offsetHeight>0){ 
			document.getElementById('li_'+typ).getElementsByTagName('a')[1].innerHTML="+"
			if ((typ=="zifferblatt") || (typ=="band")) document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[2].style.visibility="visible"
		}else{
			document.getElementById('li_'+typ).getElementsByTagName('a')[1].innerHTML="&ndash;"
		}
		FadeShowDiv('pinfo_subcon_'+typ);
		return;
	}
	if (document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[1].getElementsByTagName('i')[0]){
		v1=document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[1].getElementsByTagName('i')[0].innerHTML
	}else{
		v1=document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[1].innerHTML
	}
	v2=document.getElementById('ainfo_subcon_'+typ).getElementsByTagName('span')[2].innerHTML
	if (document.getElementById('pinfo_subcon_'+typ).style.display=="") document.getElementById('pinfo_subcon_'+typ).style.display="none"
	document.getElementById('li_'+typ).getElementsByTagName('a')[1].innerHTML="<img src='gfx/theme/loading_blue.gif'>"
	FadeShowDiv('pinfo_subcon_'+typ);
	isMoving=1
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=showvariant&v1="+ escape(v1) +"&v2="+ escape(v2) + "&typ=" + typ + "&pid=" + pid,1)
}

function showThumb(e,mh){
	if (e.isMoving==1) {
		clearTimeout(ShowThumbMoves[e.id])
	}
	e.isMoving=1
	h=e.offsetLeft
	//alert(checkBrowserName())
	ShowThumbMove (e,h,mh)
}

function ShowThumbMove(e,h,mh){
	if ((h!=mh) && (checkBrowserName()>=9)) {
		if (h<mh) h=h+Math.round(Math.abs(h-mh)/5)+1
		if (h>mh) h=h-Math.round(Math.abs(h-mh)/5)-1
		ShowThumbMoves[e.id] = setTimeout(function(){
			ShowThumbMove(e,h,mh);
			},33)
	}else{
		e.isMoving=0
	}	
	e.style.left=h+"px"
}

function ChangeSelect(text,e){
	document.getElementById(text).innerHTML=e.options[e.selectedIndex].text
	document.getElementById("OrderSaveLink").style.color="maroon"
} 

function ChangeOrderStatus(status,warenid,haendlerid,oid,e){
	LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=ChangeOrderStatus&oid=" + oid + "&warenid=" + warenid + "&haendlerid=" + haendlerid + "&status=" + status,1)
}

function requestModell(e,id,oid){
	if (e) LinkLoading(e)
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=requestModell&id=" + id + "&oid=" +oid,1)
}

function OrderSave(e){
	document.getElementById("OrderSaveLink").style.color=""
	document.getElementById("OrderSaveLink").innerHTML="wird speichert..."
	e.href='javascript:void(0)';
	urlStr=""
	c=0
	while (document.getElementById("oderID_" + c)){
		bid=document.getElementById("oderID_" + c).value
		pid=""
		ppr=""

		elCount=document.getElementById("container_info_model_" + c).getElementsByTagName('input').length
		for (i=0; i<elCount;i++){
			pv=document.getElementById("container_info_model_" + c).getElementsByTagName('input')[i].id
			py=document.getElementById("container_info_model_" + c).getElementsByTagName('input')[i].type
			if ((py=="hidden") && (pv.indexOf("modellID_")==0)) {
				tmp=document.getElementById(pv).value
				pid+=tmp + ";"
			}
			if ((py=="hidden") && (pv.indexOf("modellPreis_")==0)) {
				tmp=document.getElementById(pv).value
				ppr+=tmp + ";"
			}
		}
		c++;
		urlStr+=bid + "|-|" + pid + "|" + ppr + "|"
	}
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=changeorder&info=" + urlStr,1)
}

function OrderDetails(e,oid){
	e.href='javascript:void(0)';
	document.getElementById("hiddenclicker5").href="..\\shop\\html\\popup_bestellung.asp?orderID=" + oid
	$('#hiddenclicker5').trigger('click');
}

function saveSaldo(e,oid){
	if (e) LinkLoading(e)
	amount=document.getElementById("amount").value
	info=document.getElementById("info").value
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=savesaldo&oid=" + oid + "&amount=" + amount + "&info=" + escape(info),1)
}

function changeSaldo(e,oid){
	e.href='javascript:void(0)';
	document.getElementById("msgbox").href="..\\shop\\html\\popup_inputbox.asp?oid=" + escape(oid)
	$('#msgbox').trigger('click');
}

function afterCC(status){
	//parent.$.fancybox.close();
	if (status=="ACK") {
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=finishcash",1)	
	}else{
		parent.$.fancybox.close();
	}
}

function FinishCash(e){
	e.href='javascript:void(0)';
	paymethod=";" + document.getElementById("Extras").value	
	extraNFO=document.getElementById("extrainfo").innerHTML
	
	e.href='javascript:void(0)';
	if (document.getElementById("agbs").checked==false){
		document.getElementById("payAgb").style.display="block"
		document.getElementById("payMethod1").style.display="none"
		document.getElementById("payMethod2").style.display="none"
		document.getElementById("hiddenclicker4").href="#data9"
		$('#hiddenclicker4').trigger('click');
	}else{
		URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=finishcash2&extrainfo=" + escape(extraNFO) + "&paymethod=" + escape(paymethod),1)
	}
}
function SaveCostumer(){
	urlStr=""	
	TabTxt="ADMIN"
	urlStr+=TabTxt+"|"
	elCount=document.getElementById('costumer_info').getElementsByTagName('input').length
	for (i=0; i<elCount;i++){
		pv=document.getElementById('costumer_info').getElementsByTagName('input')[i].id
		pt=document.getElementById('costumer_info').getElementsByTagName('input')[i].value
		pc=document.getElementById('costumer_info').getElementsByTagName('input')[i].checked
		py=document.getElementById('costumer_info').getElementsByTagName('input')[i].type
		pok=1
		if (py=="radio"){
			if (pc!=true) pok=0
		}
		
		if ((pok==1) && (pv.indexOf("SQL")!=-1)){
			urlStr+=escape(pv) + "|" + escape(pt) + "|"
			//wenn ein Element leer ist
			if (pt==""){
				//wenn es ein Info Feld gibt
				pvtmp=pv.replace("SQL_","")
				if (document.getElementById(pvtmp+'NFO')) nfoText=document.getElementById(pvtmp+'NFO').value
			}
		}
	}
	
	elCount=document.getElementById('costumer_info').getElementsByTagName('span').length
	for (i=0; i<elCount;i++){
		pv=document.getElementById('costumer_info').getElementsByTagName('span')[i].id
		pt=document.getElementById('costumer_info').getElementsByTagName('span')[i].innerHTML
		if (pv.indexOf("SQL")!=-1) urlStr+=escape(pv) + "|" + escape(pt) + "|"
	}	
	
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=adminsavecostumer&info=' + urlStr,1)
}

function newtodo(){
	//document.getElementById("todoID").value=""
    //document.getElementById("oldTodoText").innerHTML=""
    //document.getElementById("select_tododestination").selectedIndex=1 	
	
	usercontact('','3')
}

function HideShowDiv(divID,e){
	if (e) e.href='javascript:void(0)';
	if (document.getElementById(divID).style.display=="none"){
		document.getElementById(divID).style.display="block"
	}else{
		document.getElementById(divID).style.display="none"
	}
}

function submitTodo(){
	tmp=document.getElementById("select_tododestination").options[document.getElementById("select_tododestination").selectedIndex].value
	if (tmp=="-1"){
		alert("Bitte ein Ziel wählen!")
	}else{
		document.addinfo.submit();
	}
}

function loadTodo(id){
	usercontact('','3',id)
	//URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=loadtodo&id=' + id,1)
}

function admin_target_complete(job){
 	CheckForHash(1)
	setTimeout("parent.$.fancybox.close();",500)
}

function loadHistory(){
	document.getElementById("historyopen").innerHTML="loading..."
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_history.asp?x=1',1)
}
function loadCostumer(id,e){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_kunden.asp?userID=' + id)
	if (id!="LAST")	addhistory ("Kunde/" + id + ".html")
}

function OutputPriceTimeOut(secon){
	TimeText=""
	if (secon>0){
		if (secon >= 24*60*60){ 
	    	TimeText = TimeText + "<b>" + parseInt(secon/(24*60*60)) + "</b>d "
	    }
	    
	    secon=secon%(24*60*60) 
	    TimeText = TimeText + "<b>" + parseInt(secon/(60*60)) + "</b>h "
	    
	    secon=secon%(60*60) 
	    TimeText = TimeText + "<b>" + parseInt(secon/(60)) + "</b>m "
    
   		secon=secon%(60)   
		TimeText = TimeText + "<b>" + parseInt(secon) + "</b>s"
	}else{
		TimeText="<b>0</b>s"
	} 

	return TimeText
}



function countTags(){
	if (cgtimer) clearTimeout(cgtimer);
	elCount=document.getElementById("mylounge_price").getElementsByTagName('span').length
	for (i=0; i<elCount;i++){
		pi=document.getElementById("mylounge_price").getElementsByTagName('span')[i].id
		pv=document.getElementById("mylounge_price").getElementsByTagName('span')[i].value
		pc=document.getElementById("mylounge_price").getElementsByTagName('span')[i].checked
		if (pi.indexOf("countdown")==0){
			tmp=document.getElementById(pi+'_value').value
			document.getElementById(pi).innerHTML=OutputPriceTimeOut(tmp)
			FadeDIVin(document.getElementById(pi))
			document.getElementById(pi+'_value').value=tmp-1
		}
	}
	cgtimer=setTimeout(function(){
		countTags();
	},1000)
}

function countgueltig(s,t){
	if (cgtimer) clearTimeout(cgtimer);
	if (document.getElementById("gueltig_words")){
		if ((s!="") && (s!=undefined)) {
			s=s-1
			document.getElementById("gueltig_words").innerHTML=OutputPriceTimeOut(s)
			cgtimer=setTimeout(function(){
				countgueltig(s,t);
			},1000)
			//document.getElementById("pvtxt").innerHTML="Dieses Preisgebot gilt noch <span id=""gueltig_words"">" + gueltig_words + "</span>.</p><!--[gueltig_seconds:" + gueltig_seconds + "]-->"
		}else{
			clearTimeout(cgtimer);
			document.getElementById("pvtxt").innerHTML="Schlagen Sie uns Ihren Wunschpreis vor!"
			if (document.getElementById("gueltig_words")) document.getElementById("gueltig_words").innerHTML=""
		}
	}else{
		s=s-1*t
		t=t*2
		if (t<8){
			setTimeout(function(){
				countgueltig(s,t);
			},t*1000)
		}
	}
}

function addproduct(e){
	if (e) e.href='javascript:void(0)';
	$('#hiddenclicker4').trigger('click');
}

function addcostumer(e){
	if (e) e.href='javascript:void(0)';
	$('#hiddenclicker7').trigger('click');
}

function callback_termin(e){
	if (e) e.href='javascript:void(0)';
	document.getElementById("hiddenclicker6").href="..\\shop\\html\\popup_todo.asp?callback=1"
	$('#hiddenclicker6').trigger('click');	
}

function usercontact(e,typ,todoid){
	if (e) e.href='javascript:void(0)';
	if (document.getElementById("id_kunden_2")) document.getElementById("id_kunden_2").style.display="none"
	switch (typ) {
	   	case "3": //todo
			document.getElementById("msgbox").href="..\\shop\\html\\popup_todo.asp?id=" + todoid
			break;
	   	case "2": //sms
			document.getElementById("msgbox").href="..\\shop\\html\\popup_sms.asp"
			break;
		case "1": //email
			document.getElementById("msgbox").href="..\\shop\\html\\popup_email.asp"
			break;

		case "4": //email
			i=1;doc=""
			while (document.getElementById("email_doc_"+i)){
				if (document.getElementById("email_doc_"+i).checked) doc=doc+document.getElementById("email_doc_"+i).value + ", "
				i++;
			}
			document.getElementById("msgbox").href="..\\shop\\html\\popup_email.asp?doc="+doc
			break;
		
		default:
			document.getElementById("id_kunden_"+typ).style.display="block"
			document.getElementById("msgbox").href="#data6"
	}
	
	setTimeout(function(){
		$('#msgbox').trigger('click');	
	},100)
}

function preisangebot(e,id,okbutton){	
	/*if (document.getElementById("angebot_LP_"+id)){
		LP=document.getElementById("angebot_LP_"+id).value
		ANF=document.getElementById("angebot_anfrage_"+id).value
		ANG=document.getElementById("anfrage_angebot_"+id).value
		
		productID=document.getElementById("productID_"+id).value
		if (document.getElementById("anfrage_angebot2_"+id)){
			document.getElementById("anfrage_angebot2_"+id).innerHTML=ANG
			document.getElementById("anfrage_diff_"+id).innerHTML='<-- ' + Math.abs(ANG-ANF) + ' -->'
			document.getElementById("anfrage_proz_"+id).innerHTML=Math.round((1-ANG/LP)*1000)/10 + '%'
		}
		Tip('=' +Math.round((1-ANG/LP)*1000)/10 + '%')  
	}*/	
	
	LP=document.getElementById("angebot_LP_"+id).value
	ANG=document.getElementById("bargain_" + id).value
	tstamp=document.getElementById("timestamp_" + id).value
	Tip('=<b>' +Math.round((1-ANG/LP)*1000)/10 + '%</b> Nachlass auf Listenpreis', FIX, ['bargain_'+id, 0, 5],DURATION,10000,DELAY,50,CLICKCLOSE,true,BGCOLOR,'#eeeeee',BORDERWIDTH,0,FADEIN,250,FADEOUT,250)  
	
	productID=document.getElementById("productID_"+id).value
	  nachlass=Math.round((1-ANG/LP)*1000)/10
	
	if ((e.keyCode==13) || (okbutton==1)){
		if (nachlass>60){
		 	 msgbox("Preisnachlass zu hoch! (" + nachlass + "%)")
		 	 UnTip()
		 	 return;
		}
		UnTip()
		//Preisangebot machen
		loadProductblock(id,productID);
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=pricereply&tstamp=' + tstamp + '&eid=' + id + '&pid=' + productID + '&ang=' + ANG,1)
	}
}

function loadProductblock(eid,pid,typ,sessID,wID,oid){
	if (document.getElementById('more_info_'+ eid).style.display=="none"){
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=generateproductblock&oid=' + oid + '&wID=' + wID + '&sessID=' + sessID + '&typ=' + typ + '&eid=' + eid + '&pid=' + pid,1)
	}else{
		FadeShowDiv('more_info_'+eid);
	}
}

function CashCalcRate(){
	sp=document.getElementById("cashSumPrice").innerHTML
	az=document.getElementById("SQL_Anzahlung").value
	if (az*1>sp*1) {
		az=sp
		document.getElementById("SQL_Anzahlung").value=az
	}
	document.getElementById('SQL_laufzeit').innerHTML=document.getElementById("cashbox_select_laufzeit").options[document.getElementById("cashbox_select_laufzeit").selectedIndex].value
	lz=document.getElementById("cashbox_select_laufzeit").options[document.getElementById("cashbox_select_laufzeit").selectedIndex].value

	zins=0.0790
	if (lz<=60) zins=0.0790//0.0990
	if (lz<=48) zins=0.0790//0.0890
	if (lz<=36) zins=0.0790
	if (lz<=12) zins=0.0490
	if (lz<=6) zins=0.0000001
	
	actlPrice=sp-az
	Rate=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,lz))/(Math.pow(1+zins/12,lz)-1))

	document.getElementById("cashRate").innerHTML=Rate
	document.getElementById("cashZinz").innerHTML=Math.round(zins*1000)/10
	
}

function ShowDivHideAll(divID,nr,e,noslide){
	if (nr==-1) {
		i=1
		while (document.getElementById(divID+i)){ 
			if (noslide) {
				document.getElementById(divID+i).style.display="block"
			}else{
				FadeShowDiv (divID+i)
			}		
			i++
		}
		return;
	}

	//noslide=true
	if (e) e.href='javascript:void(0)';
	if (document.getElementById(divID+nr)){
		//wenn es schon offen ist...
		if (document.getElementById(divID+nr).style.display=="block"){
			if (noslide) {
				document.getElementById(divID+nr).style.display="none"
			}else{
				HideDivMove (divID+nr,0)
			}
			return;
		}
	}
	
	if (document.getElementById(divID+"0")) document.getElementById(divID+"0").style.display="none"
	i=1
	while (document.getElementById(divID+i)){ 
		if (!(document.getElementById(divID+i).style.display=="none")) 
		if (noslide) {
			document.getElementById(divID+i).style.display="none"
		}else{
			HideDivMove (divID+i,0)
		}		
		i++
	}
	if (noslide) {
		document.getElementById(divID+nr).style.display="block"
	}else{
		FadeShowDiv (divID+nr)
	}
	
}

function searchuserclick(){
	 if (document.getElementById('searchuser').value=="Kunden suchen")  document.getElementById('searchuser').value=""
}

function searchuserkeypress(e,d){
	if((e.keyCode==13) || (d==1)){
		searchTXT=document.getElementById('searchuser').value.replace (/^\s+/, '').replace (/\s+$/, '');
		if (searchTXT=="Kunden suchen") searchTXT=""
		document.getElementById('searchuser').value=searchTXT
		URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_kunden.asp?searchtxt=' + searchTXT)
		addhistory ("Kunden/" + searchTXT + ".html")
	}
}

function searchkeypress(e,d){
	if((e.keyCode==13) || (d==1)){
		searchTXT=document.getElementById('searchtext').value.replace (/^\s+/, '').replace (/\s+$/, '');
		if (searchTXT=="Kunden suchen") searchTXT=""
		if (searchTXT=="") {
			msgbox ("Bitte geben Sie einen Suchbegriff ein.\n\nSie können frei nach einem beliebigen Herstellername, dem Namen der Serie oder einer Referenznummer suchen. Es ist auch möglich die Suchbegriffe beliebig zu kombinieren.")
			/*document.getElementById("serien_menu_container_right").innerHTML="\n<li style='width:730px'><a id='search_brick' onmouseout='FadeDIVout(this);' onmouseover='FadeDIVin(this);' href='javascript:void(0)'>Detailsuche</a></li>"
			document.getElementById('serien_menu_controls_filter').style.display="none"
			document.getElementById('serien_menu_controls').style.display="block"
			document.getElementById('controls_middle').innerHTML="<b>Zurück</b> zur Detailsuche"
			document.getElementById('controls_middle').href="#search.html" 
			loadAJAX("search","")*/
			return;
		}
		if (document.getElementById("serien_menu_middle").offsetHeight!=85){
			document.getElementById("serien_menu_middle").style.height="auto"
			//tmp=document.getElementById("serien_menu_middle").offsetHeight
			tmp=85
			tM = new Tween(document.getElementById('serien_menu_middle').style,'height',Tween.bounceEaseOut,tmp,85,1,'px');
			tM.start()	
		}
		document.getElementById('searchtext').value=searchTXT
		document.getElementById('serien_menu_controls_filter').style.display="block"
		document.getElementById('serien_menu_controls').style.display="none"
		document.getElementById("serien_menu_container_right").innerHTML="\n<li style='width:730px'><a id='search_brick' onmouseout='FadeDIVout(this);' onmouseover='FadeDIVin(this);' href='javascript:void(0)'>searching...</a></li>"
		document.getElementById('controls_middle').innerHTML="<b>Zurück</b> zu Ihren Suchergebnissen"
		document.getElementById('controls_middle').href="#Suche/" + searchTXT +".html" 
		document.getElementById("leftmenu_selectedbrand_link").innerHTML="Suchergebnisse"
		document.getElementById("leftmenu_selectedbrand_link").onclick="" 
		document.getElementById("leftmenu_selectedbrand_link").title="Suchergebnisse anzeigen" 
		document.getElementById("leftmenu_selectedbrand_link").href="#Suche/" + searchTXT +".html"
		document.getElementById('serien_menu_controls_filter').style.display="block"
		document.getElementById('serien_menu_controls').style.display="none"
		document.getElementById('controls_middle').onclick=""
		document.getElementById('controls_middle').onmouseover=function() {FadeDIVin(this);}
		document.getElementById('controls_middle').onmouseout=function() {FadeDIVout(this);}	
		serien_id=""
		serien_name=""
		for (var i=1; i<6; i++) {
			document.getElementById('filter_dropdown_' + i).innerHTML=""
			document.getElementById("filter_label_" +i).innerHTML="Alle +"
		}
		addhistory ("Suche/" + searchTXT + ".html")
		URLRequest('http://www.uhrenlounge.de/shop/html/ajax_serien.asp?searchtxt=' + searchTXT)
	}
}

function searchclick(){
	 if (document.getElementById('searchtext').value=="Produktsuche")  document.getElementById('searchtext').value=""
}

function addadminimage(){
	document.getElementById('uploadref').innerHTML="REF.: " + document.getElementById('referenz').innerHTML
	useMask(document.getElementById("select_diax").options[document.getElementById("select_diax").selectedIndex].text)
	$('#hiddenclicker5').trigger('click');
}

function startupload(typ){
	if (typ==1){
		document.getElementById('filename').value=""
		document.getElementById('imgupload').src=""
		document.getElementById('uploadimgname').innerHTML="loading..."
	}else{
		document.getElementById('uploadimgname').innerHTML="scaling..."
	}
}

function savecomplete(filename){
	setTimeout(function(){
		document.getElementById('Productbild').src="../shop/gfx/products/tmp/" + filename
		document.getElementById("Productbild_link").href="../shop/gfx/products/tmp/" + filename
		document.getElementById('Productbild2').value=filename
		if (document.getElementById('productid').value!="")	document.getElementById('save1').style.display="block"
		if (document.getElementById('save2')) document.getElementById('save2').style.display="block"
		document.getElementById('uploadimgname').innerHTML=""
		setTimeout("parent.$.fancybox.close();",200)
	},200)
}

function uploadcomplete(filename){
	if (filename==""){
		alert("upload fehlgeschlagen")
		document.getElementById('uploadimgname').innerHTML=""
	}else{
		document.getElementById('imgupload').src="../shop/gfx/products/productfotos/" + filename
		document.getElementById('uploadimgname').innerHTML="FILE: " + filename
		if (filename.indexOf(document.getElementById('referenz').innerHTML)!=-1){
			document.getElementById('uploadimgnameinfo').innerHTML=""
			document.getElementById('uploadimgnameinfo').style.color=""
		}else{
			document.getElementById('uploadimgnameinfo').style.color="maroon"
			document.getElementById('uploadimgnameinfo').innerHTML="!!! Referenz weicht von Filename ab !!!"
		}
		document.getElementById('filename').value=filename
		setTimeout(function(){
			if (mS) {
				document.getElementById("param").value=mY + ";" + mX + ";" + mS
				document.getElementById("param2").innerHTML="Xc:" + mX + " | Yc:" + mY + " | Width:" + mS
				document.getElementById("imgupload").style.top=mY + "px"
				document.getElementById("imgupload").style.left=mX + "px"
				document.getElementById("imgupload").width=mS
			}
		
			//mY=document.getElementById("imgupload").style.top.replace("px","")
			//mX=document.getElementById("imgupload").style.left.replace("px","")
			//mS=document.getElementById("imgupload").width
			//document.getElementById("param").value=mY + ";" + mX + ";" + mS
			//document.getElementById("param2").innerHTML="Xc:" + mX + " | Yc:" + mY + " | Width:" + mS
		},300)
	}
}

function useMask(size){
	size=size.replace((/,/g), ".")
	size=Math.round(size)
	document.getElementById('imgmask').src="../shop/gfx/products/mask/mask_" + size + ".png"
	document.getElementById('mask').innerHTML=size+"mm"
}


function replaceSelectN(sid,nval){
	if (document.getElementById(sid)){
		for (i=0;i<document.getElementById(sid).length;i++){
			if (document.getElementById(sid).options[i].value=="N"){
				tmp=document.getElementById(sid).options[i].text
				if (nval!=null) {
					for (s=0;s<document.getElementById(sid).length;s++){ 
						if (document.getElementById(sid).options[s].value==nval) {
							document.getElementById(sid).options[s] = null	
							i=i-1
						}
					}
					document.getElementById(sid).options[i] = new Option(tmp,nval,false,true);
				}else{
					document.getElementById(sid).options[i] = null
				}
			}
		}
	}
}

function setfunctions(fids){
	tmp=fids.split(";")
	elCount=document.getElementById("adminfunctions").getElementsByTagName('input').length
	for (i=0; i<elCount;i++){
		document.getElementById("adminfunctions").getElementsByTagName('input')[i].checked=false
	}
	for (var i=0; i<tmp.length-1; i++) {
		document.getElementById(tmp[i]).checked=true
	}
}

function selectSBox(sbid,sbvalue){
	tmp=sbid.split("_")
	pid=tmp[1]
	document.getElementById(sbid).value=sbvalue
	document.getElementById(pid).innerHTML=document.getElementById(sbid)[document.getElementById(sbid).selectedIndex].text
}

function setELValues(cid){
	el=document.getElementById(cid)
	if (el.selectedIndex!=-1){
		pv=el[el.selectedIndex].value
		pt=el[el.selectedIndex].text
		return [pv,pt]
	}else{
		return [0,0]
	}
}

function clickcheckbox(e){
	e.style.opacity="1"	
	if (document.getElementById('productid').value!="")	document.getElementById('save1').style.display="block"
	document.getElementById('save1').style.display="block"
	if (document.getElementById('save2')) document.getElementById('save2').style.display="block"
	document.getElementById('delete1').style.display="none"
}

function productmove(e,m){
	if (e) LinkLoading(e)
	pID=document.getElementById("productid").value
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_addproduct.asp?Product_id=' + pID + "&m=" +m)
}

function deleteproduct(){
	choice=confirm('möchten Sie Ihre das Produkt wirklich löschen?')
	if (choice==true){
		pID=document.getElementById("productid").value
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=delproduct&productID=' + pID,1)	
	}
}

function submitnewproduct(np){
	urlStr=""
	document.getElementById('save1').style.display="none"
	elCount=document.getElementById("product_block_middle_head_middle").getElementsByTagName('input').length
	for (i=0; i<elCount;i++){
		pv=document.getElementById("product_block_middle_head_middle").getElementsByTagName('input')[i].id
		pt=document.getElementById("product_block_middle_head_middle").getElementsByTagName('input')[i].value
		urlStr+=escape(pv) + "|" + escape(pv) + "|" + escape(pt) + "|"
	}	
	
	elCount=document.getElementById("product_block").getElementsByTagName('select').length
	for (i=0; i<elCount;i++){
		cid=document.getElementById("product_block").getElementsByTagName('select')[i].id
		pv=setELValues(cid)[0]
		pt=setELValues(cid)[1]
		urlStr+=cid + "|" + escape(pv) + "|" + escape(pt) + "|"
		
	}
	
	urlStr+="Productbild|" + document.getElementById("Productbild2").value + "|" + document.getElementById("Productbild2").value + "|"
	
	elCount=document.getElementById("adminfunctions").getElementsByTagName('input').length
	for (i=0; i<elCount;i++){
		if (document.getElementById("adminfunctions").getElementsByTagName('input')[i].checked==true){
			pv=document.getElementById("adminfunctions").getElementsByTagName('input')[i].id
			po=document.getElementById("adminfunctions").getElementsByTagName('input')[i].style.opacity
			pt=document.getElementById("adminfunctions").getElementsByTagName('input')[i].alt
			urlStr+="Funktion|" + escape(pv) + "|" + escape(pt) + "|" + escape(po) + "|"
		}
	}
	
	elCount=document.getElementById("adminfotos").getElementsByTagName('input').length
	if ((np==1)&&(elCount!=0)){
		box=window.confirm("Möchten Sie die bestehenden, ausgewählten Bilder auf das neue Produkt übernehmen?")
		if(box!=true) elCount=0
	}
	
	for (i=0; i<elCount;i++){
		if (document.getElementById("adminfotos").getElementsByTagName('input')[i].checked==true){
			pt=document.getElementById("adminfotos").getElementsByTagName('input')[i].alt
			urlStr+="Fotos|" + escape(pt) + "|" 
		}
	}
	
	pID=document.getElementById("productid").value

	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addproduct&np=' + np + '&productID=' + pID + '&info=' + urlStr,1)	
}

function addnewfunction(){
	choice=prompt("Bitte geben Sie den Namen für die Funktion ein","")
	if (choice!=null) document.getElementById("adminfunctions").innerHTML+="<div class=\"product_function\">" + choice + ": <span><input onclick=\"clickcheckbox()\" alt=\""+ choice + "\" id=\"N\" type=\"checkbox\" /></span></div>"
}

function SelectAddProductTab(tab){
	document.getElementById('product_display_1').style.display="none"
	document.getElementById('product_display_2').style.display="none"
	document.getElementById('product_display_3').style.display="none"
	document.getElementById('product_display_4').style.display="none"
		document.getElementById('product_display_' + tab).style.display="block"
	//FadeShowDiv('product_display_' + tab)
	//hs=document.getElementById('hersteller').innerHTML
	//ref=document.getElementById('referenz').innerHTML
	//if (tab==4) document.getElementById('bilder').src="http://www.google.de/images?as_q=16610+rolex&hl=de&gbv=2&btnG=Google-Suche&as_epq=&as_oq=&as_eq=&as_sitesearch=&safe=off&as_st=y&tbs=isch:1,isz:lt,islt:qsvga#q=" + hs + " " + ref + "&hl=de&safe=off&gbv=2&as_st=y&tbs=isch:1,isz:lt,islt:qsvga,ic:specific,isc:white&source=lnt♦"
}
function loadtemplate2(e){
	if (e.length==1) loadtemplate(e)
}
function loadtemplate(e){
	if (e.options[e.selectedIndex].value=="G") return;
	input = document.getElementById('email_Text')
	
	document.getElementById('template').innerHTML=e.options[e.selectedIndex].text
	tmp2=document.getElementById('v'+e.options[e.selectedIndex].value).value

    /* Einfügen des Formatierungscodes */
    var start = input.selectionStart;
    var end = input.selectionEnd;
    var insText = input.value.substring(start, end);
    input.value = input.value.substr(0, start) + tmp2 + input.value.substr(end);
    /* Anpassen der Cursorposition */
    var pos;
    pos = start + tmp2.length;
    input.focus();
    input.selectionStart = start;
    input.selectionEnd = pos;
}

function selectchange2(eid){
	if (eid.length==1) selectchange(eid)
}

function selectchange(eid) {
	if (document.getElementById('save1')) document.getElementById('save1').style.display="block"
	if (document.getElementById('save2')) document.getElementById('save2').style.display="block"
	document.getElementById('delete1').style.display="none"
	tmp=eid.id.split("_")
	pid=tmp[1]
	tmp0=document.getElementById(pid).innerHTML
	tmp1=eid.options[eid.selectedIndex].text
	tmp2=eid.options[eid.selectedIndex].value
	if ((pid=="mask") || (pid=="diax")){ 
		useMask(tmp2)
	}
	if ((tmp2=="0") && ((tmp1=="Neuer Eintrag") || (tmp1=="anderes Datum")) &&  (pid!="status")) {
		choice=prompt("Bitte bestimmen Sie den neuen Eintrag in der Spalte " + pid,tmp0)
		if (choice!=null){
			replaceSelectN(eid.id)
			if ((eid.id=="select_caseheight") || (eid.id=="select_diax") || (eid.id=="select_diay") || (eid.id=="select_water") || (eid.id=="select_setdate")){
				eid.options[eid.length] = new Option(choice, choice,false,true);
			}else{
				eid.options[eid.length] = new Option(choice, "N",false,true);
			}
			eid.text=choice
			document.getElementById(pid).innerHTML=choice
		}
	}else{
		document.getElementById(pid).innerHTML=tmp1
	}
	if (pid=="caliber"){
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getadmininfo&typ=' + pid + '&info=' + tmp2,1)		
	}
}

function ObjectPosition(obj) {
	    var curleft = 0;
	      var curtop = 0;
	      if (obj.offsetParent) {
	            do {
	            	
	                  curleft += obj.offsetLeft;
	                  curtop += obj.offsetTop;
	            } while (obj = obj.offsetParent);
	      }
	      return [curleft,curtop];
	      
}

function MoveDivMove(divID,mh,speed){
	if (!(document.getElementById("sDIVup_"+ sliderID))) return;
	
	hUP=document.getElementById("sDIVup_"+ sliderID).offsetTop+5
	hDOWN=document.getElementById("sDIVdown_"+ sliderID).offsetTop-document.getElementById("sDIVdown_"+ sliderID).offsetHeight+15
	if (divID=="sDIVup_"+ sliderID) {
		if (mh>hDOWN) mh=hDOWN
	}
	if (divID=="sDIVdown_"+ sliderID) {
		if (mh<hUP) mh=hUP
	}
	h=document.getElementById(divID).offsetTop
	objpos=ObjectPosition(document.getElementById("scrollarea_"+ sliderID))
	objheight=document.getElementById("scrollarea_"+ sliderID).offsetHeight
	if (speed==undefined) speed=5
		
	if (h<mh) {
		h=h+(Math.round(Math.abs(h-mh)/speed)+1)
		MoveTimer=setTimeout("MoveDivMove('" + divID + "'," + mh + "," + speed + ")",33)
	}
	if (h>mh) {
		h=h-(Math.round(Math.abs(h-mh)/speed)+1)
		MoveTimer=setTimeout("MoveDivMove('" + divID + "'," + mh + "," + speed + ")",33)
	}
	
	if ((h-mh)==0){
		clearTimeout(MoveTimer)
	}

	if (h<0){
		clearTimeout(MoveTimer)
		h="0"
	}
	
	if (h>objheight){
		clearTimeout(MoveTimer)
		h=objheight
	}
	s1=document.getElementById("sDIVup_"+ sliderID).offsetTop
	s2=document.getElementById("sDIVdown_" + sliderID).offsetTop
	
	document.getElementById("sDIVmiddle_"+ sliderID).style.top=s1+5+"px"
	document.getElementById("sDIVmiddle_"+ sliderID).style.height=(s2-s1)+"px"
	
	document.getElementById(divID).style.top=h+"px"
	
	//document.getElementById("serien_menu_brick_link_1").innerHTML= sliderValue1 + "/" + sliderValue2
	//document.getElementById("serien_menu_brick_link_2").innerHTML= divUpPos + "/" + divDownPos
}

function handle(delta) {
	if (!(document.getElementById("imgupload").width)) return;
	
	tmp=document.getElementById("imgupload").width
	if (lastWheel==null) lastWheel=0
	if (delta < 0){
		if (lastWheel>0) lastWheel=0
		lastWheel=lastWheel-1
	tmp=tmp+lastWheel //-1
	}else{
		if (lastWheel<0) lastWheel=0
		lastWheel=lastWheel+1
	tmp=tmp+lastWheel
	}
	document.getElementById("imgupload").style.width=tmp+"px"
	
	if (document.getElementById("imgupload").width!=0){
		mS=document.getElementById("imgupload").width
		document.getElementById("param").value=mY + ";" + mX + ";" + mS
		document.getElementById("param2").innerHTML="Xc:" + mX + " | Yc:" + mY + " | Width:" + mS
	}
}

/** Event handler for mouse wheel event.
 */
function wheel(event){
		if (!(document.getElementById("uploadimgname"))) return;
		if (document.getElementById("uploadimgname").innerHTML=="") return;
        var delta = 0;
        if (!event)
                event = window.event;
        if (event.wheelDelta) {
                delta = event.wheelDelta/120;
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { 
                delta = -event.detail/3;
        }
        if (delta) handle(delta);
        if (event.preventDefault) event.preventDefault();
	event.returnValue = false;
}

function onkeydown(e){
	if (document.getElementById("imgupload")){
		wkey = e.which?e.which:window.event.keyCode;
		if (document.getElementById("imgupload").width!=0) {
			mY=document.getElementById("imgupload").style.top.replace("px","")
			mX=document.getElementById("imgupload").style.left.replace("px","")
			mS=document.getElementById("imgupload").width
			switch (wkey){
			case 37:
				mX=mX*1-0.5*1
				break;
				
			case 38:
				mY=mY*1-0.5*1
				break;
				
			case 39:
				mX=mX*1+0.5*1
				break;
				
			case 40:
				mY=mY*1+0.5*1
				break;
			}
			lastWheel=0
			document.getElementById("param").value=mY + ";" + mX + ";" + mS
			document.getElementById("param2").innerHTML="Xc:" + mX + " | Yc:" + mY + " | Width:" + mS
			document.getElementById("imgupload").style.top=mY + "px"
			document.getElementById("imgupload").style.left=mX + "px"
		}
	}
}

function mousedown(e) {
	if (!e) var e = window.event;
	if (e.which) mouseclick = e.which;
	else if (e.button) mouseclick = e.button;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
	targ = targ.parentNode;
	//setTimeout("alert('" + targ.id + "')",100)
	if (targ.id.indexOf("info_model_img_")!=-1) {
		dragElementID=targ.id.replace("info_model_img_","")
		movePimage=2
		movePimageX_start=document.getElementById("info_model_" + dragElementID+"_frame").style.left
		movePimageY_start=document.getElementById("info_model_" + dragElementID+"_frame").style.top
		movePimageX=e.pageX-document.getElementById("info_model_" + dragElementID+"_frame").style.left.replace("px","")
		movePimageY=e.pageY-document.getElementById("info_model_" + dragElementID+"_frame").style.top.replace("px","")	
		document.getElementById("info_model_" + dragElementID+"_frame").style.opacity="0.3"	
		
	}

	if ((targ.id=="imgmask")) {
		movePimage=1
		movePimageX=e.pageX-document.getElementById("imgupload").style.left.replace("px","")
		movePimageY=e.pageY-document.getElementById("imgupload").style.top.replace("px","")
		
	}
	
	if ((targ.id=="scrollarea_1") || (targ.id=="sDIVmiddle_1")) {
		sliderID=1
		divUpPos=Math.abs(document.getElementById("sDIVup_1").offsetTop-(e.pageY-document.getElementById("filter_dropdown_1").offsetTop-10))
		divDownPos=Math.abs(document.getElementById("sDIVdown_1").offsetTop-(e.pageY-document.getElementById("filter_dropdown_1").offsetTop-10))
		if (divUpPos<divDownPos) {
			moveDone=2;
		}else{
			moveDone=3;
		}
	}
	
	if ((targ.id=="scrollarea_5") || (targ.id=="sDIVmiddle_5")) {
		sliderID=5
		divUpPos=Math.abs(document.getElementById("sDIVup_5").offsetTop-(e.pageY-document.getElementById("filter_dropdown_5").offsetTop-10))
		divDownPos=Math.abs(document.getElementById("sDIVdown_5").offsetTop-(e.pageY-document.getElementById("filter_dropdown_5").offsetTop-10))
		if (divUpPos<divDownPos) {
			moveDone=5;
		}else{
			moveDone=6;
		}
	}
	tmp=ObjectPosition(document.getElementById("scrollspacer"))	
	if (MoveTimer) clearTimeout(MoveTimer);
	
	if ((moveDone==2) || (targ.id=="sDIVup_1")) {
		sliderID=1
		moveDone=2;
		tmp=ObjectPosition(document.getElementById("scrollspacer_1"))
		MoveDivMove ("sDIVup_" + sliderID, e.pageY - tmp[1]-10)
	}
	
	if ((moveDone==3) || (targ.id=="sDIVdown_1")) {
		sliderID=1
		moveDone=3;
		tmp=ObjectPosition(document.getElementById("scrollspacer_1"))
		MoveDivMove ("sDIVdown_" + sliderID, e.pageY - tmp[1]-10)
	}

	if ((moveDone==5) || (targ.id=="sDIVup_5")) {
		sliderID=5
		moveDone=5;
		tmp=ObjectPosition(document.getElementById("scrollspacer_5"))
		MoveDivMove ("sDIVup_" + sliderID, e.pageY - tmp[1]-10)
	}
	if ((moveDone==6) || (targ.id=="sDIVdown_5")) {
		sliderID=5
		moveDone=6;
		tmp=ObjectPosition(document.getElementById("scrollspacer_5"))
		MoveDivMove ("sDIVdown_" + sliderID, e.pageY - tmp[1]-10)
	}
}

function mousemove(e) {
	if (!e) var e = window.event;
	if (e.which) mouseclick = e.which;
	else if (e.button) mouseclick = e.button;
	
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
	targ = targ.parentNode;
		
	if (movePimage==2){
		mY=e.pageY*1-movePimageY*1
		mX=e.pageX*1-movePimageX*1
		document.getElementById("info_model_" + dragElementID+"_frame").style.top=mY + "px"
		document.getElementById("info_model_" + dragElementID+"_frame").style.left=mX + "px"
	}
	
	if (movePimage==1){
		mY=e.pageY*1-movePimageY*1
		mX=e.pageX*1-movePimageX*1
		mS=document.getElementById("imgupload").width
		document.getElementById("param").value=mY + ";" + mX + ";" + mS
		document.getElementById("param2").innerHTML="Xc:" + mX + " | Yc:" + mY + " | Width:" + mS
		document.getElementById("imgupload").style.top=mY + "px"
		document.getElementById("imgupload").style.left=mX + "px"
		lastWheel=0
	}
	
	if ((moveDone==2) || (((moveDone==1) && ((targ.id=="sDIVup_1"))))) {
		sliderID=1
		moveDone=2;
		if (MoveTimer) clearTimeout(MoveTimer);
		tmp=ObjectPosition(document.getElementById("scrollspacer_1"))
		MoveDivMove ("sDIVup_" + sliderID, e.pageY - tmp[1]-10)
	}	
	if ((moveDone==3) || (((moveDone==1) && ((targ.id=="sDIVdown_1"))))) {
		sliderID=1
		moveDone=3;
		if (MoveTimer) clearTimeout(MoveTimer);
		tmp=ObjectPosition(document.getElementById("scrollspacer_1"))
		MoveDivMove ("sDIVdown_" + sliderID, e.pageY - tmp[1]-10)
	}
	
	if ((moveDone==5) || (((moveDone==1) && ((targ.id=="sDIVup_5"))))) {
		sliderID=5
		moveDone=5;
		if (MoveTimer) clearTimeout(MoveTimer);
		tmp=ObjectPosition(document.getElementById("scrollspacer_5"))
		MoveDivMove ("sDIVup_" + sliderID, e.pageY - tmp[1]-10)
	}	
	if ((moveDone==6) || (((moveDone==1) && ((targ.id=="sDIVdown_5"))))) {
		sliderID=5
		moveDone=6;
		if (MoveTimer) clearTimeout(MoveTimer);
		tmp=ObjectPosition(document.getElementById("scrollspacer_5"))
		MoveDivMove ("sDIVdown_" + sliderID, e.pageY - tmp[1]-10)
	}
}
function mouseup(e) { 
	if ((document.getElementById("info_model_" + dragElementID+"_frame")) && (movePimage==2)) {
		i=0
		while (document.getElementById("body_model_frame_" + i)) {
			if (document.getElementById("body_model_frame_" + i)){
				objpos=ObjectPosition(document.getElementById("body_model_frame_" + i))				
				mX=e.pageX-document.getElementById('shop').offsetLeft
				mY=e.pageY
				cX=objpos[0]-document.getElementById('shop').offsetLeft
				cY=objpos[1]
				cH=document.getElementById("body_model_frame_" + i).offsetHeight
				cW=document.getElementById("body_model_frame_" + i).offsetWidth
				if ((((mX>cX-50) && (mX<cX+cW+50) && (mY>cY) && (mY<cY+cH))) && (document.getElementById("body_model_frame_" + i).className=="model_body_left")) {
					document.getElementById("OrderSaveLink").style.color="maroon"
					document.getElementById("info_model_" + dragElementID+"_frame").style.opacity="1"
					document.getElementById("info_model_" + dragElementID+"_frame").style.left="-11px"
					tmp=document.getElementById("info_model_" + dragElementID+"_frame").innerHTML
					document.getElementById("info_model_" + dragElementID+"_frame").parentNode.removeChild(document.getElementById("info_model_" + dragElementID+"_frame"))
					tmp="<div id=\"info_model_" + dragElementID + "_frame\" class=\"info_model_leftrow\">" + tmp + "</div>"
					document.getElementById("container_info_model_" + i).innerHTML=tmp+document.getElementById("container_info_model_" + i).innerHTML
					moveDone=0;
					movePimage=0
					return;
				}else{
					document.getElementById("info_model_" + dragElementID+"_frame").style.opacity="1"
					document.getElementById("info_model_" + dragElementID+"_frame").style.top=movePimageX_start
					document.getElementById("info_model_" + dragElementID+"_frame").style.left=movePimageY_start	
				}
			}
		i++;
		}
	}
	moveDone=0;
	movePimage=0
}

if (document.layers) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
document.onmousedown = mousedown
document.onmousemove = mousemove
document.onmouseup = mouseup
document.onkeydown = onkeydown

if (window.addEventListener)
	window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;

/* Überwachung von Internet Explorer initialisieren */
//if (!window.Weite && document.documentElement && document.documentElement.offsetWidth) {
//window.onresize = checkSize;
//}

/* Überwachung von Netscape initialisieren */
//if (!window.Weite && window.innerWidth) {
//  window.onresize = checkSize;
//}

function firststart(x){
	if (firstStartOk==1) return;
	if (window.loading==1) {
		setTimeout(function(){
			firststart();
		},250)
		return;
	}
	firstStartOk=1
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addBasket&productID=0',1)
	setTimeout("AutoFadeAdvImg()",1000)
	setTimeout("switchTopImg()",2000)
	if (x==1) setTimeout("loginPopup(this);",500)
}

function checkSize()
{
if (document.documentElement.clientWidth<1150) 
	{
	//document.getElementById('shop_left').style.display="none"
	//document.getElementById('shop_right').style.display="none"
	}else{
	//document.getElementById('shop_left').style.display="block"
	//document.getElementById('shop_right').style.display="block"	
	}
}

function addhistory(action){
	//document.getElementById("LocationAnchor").name = action;
	LastNavigationStep=escape(action)
	document.location.hash = escape(action)
	pageTracker._trackPageview(action);
	//document.getElementById('shop_middle_top_img').style.backgroundImage="url(../shop/gfx/theme/silver_models_bar_bottom_small.png)"
}

function addBrand() {
	brandName=prompt("Name des Herstellers [deutsch]","Rolex")
	if (brandName!=null) URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addBrand&brandName=' + brandName,1)
}

function slideproducttext(n){
	alert("geht noch nicht, gernot!")
	//URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=slideproducttext&n=' + n,1)
}

function canceluserbrandtext(){
	document.getElementById('starttext_edit_1').style.display="none"
	document.getElementById('starttext_edit_2').style.display="block"
}

function ajaxpostok(typ){
//	document.getElementById('brand_text_head').innerHTML=document.getElementById('user_brand_text_head').value.replace(/\r?\n|\r/g, "<br/>");
//	document.getElementById('brand_text').innerHTML=document.getElementById('user_brand_text').value.replace(/\r?\n|\r/g, "<br/>");
	CheckForHash(1)
	alert("Änderung gespeichert")
}

function resizetextarea(t) {
	//a = t.value.split('\n');
	//b=a.length;
	//t.style.height = b*20+20 + "px";
}

function showLogin(){
	if (document.getElementById('login').innerHTML=="Login") {
		document.getElementById('topmenu_shop_menu').style.display='none';
		document.getElementById('topmenu_login_menu').style.display='block';
	}else{
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=logout',1)
	}
}

function logout(e){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=logout',1)
}
function doLogin(keycode){
	if ((keycode==13) || (keycode==undefined)) {
		uname=document.getElementById('loginname').value
		pword=document.getElementById('loginpasswort').value
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=login&username=' + escape(uname) + '&password=' + escape(pword),1)
	}
}

function SetOpacity(object,opacityPct)
{
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  object.style.MozOpacity = opacityPct/100;
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO){
	var element=document.getElementById(id);
	if (element){
		var opacity = element.style.opacity * 100;
		var msNow = (new Date()).getTime();
		opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
		if (opacity<0) 
			SetOpacity(element,0)
		else if (opacity>100)
			SetOpacity(element,100)
		else{
			SetOpacity(element,opacity);
			element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
		}
	}
}


function FadeAdvImg(id) {
	if (!(document.getElementById("start_advert_area_link_1"))) return;
	tmp=0
	z0=0
	id0=0
	while (document.getElementById("advert_img_" + tmp)){
		z=document.getElementById("advert_img_" + tmp).style.zIndex
		document.getElementById("advert_img_" + tmp).style.display="block"
		document.getElementById("start_advert_area_link_" + tmp).style.backgroundPosition="370px 0px"
		if (z>z0) {
			z0=z
			id0=tmp
		}
		tmp=tmp+1
	}
	if (id==undefined) {
		id=id0+1
		if (id>2) id=0
	}else{
		if (AutoFadeAdvImgTimeOut) clearTimeout(AutoFadeAdvImgTimeOut)
	}
	
	document.getElementById("start_advert_area_link_" + id).style.backgroundPosition="0px 0px"
	document.getElementById("advert_img_" + id).style.zIndex=z0*1+1
	var startMS = (new Date()).getTime();
	if (id0!=id) ChangeOpacity("advert_img_" + id,700,startMS,0,100)
}

function AutoFadeAdvImg() {
	FadeAdvImg()
	AutoFadeAdvImgTimeOut=setTimeout("AutoFadeAdvImg()",10000)
}

function move_menue(element_id,h_id,loggeduser)
{	 
	if (isMoving==1) return;
	
	if ((h_id!=null) && (element_id.HerstellerID==null) ) element_id.HerstellerID=h_id 	 
	htmp=element_id.id.split("_")
	hersteller_id=h_id
	if ((h_id==undefined) || (h_id=='')) hersteller_id=htmp[1]
	hersteller_name=element_id.innerHTML
	if ((element_id.id.slice(0,3)=="top") && (element_id.HerstellerID!=null)) hersteller_id=element_id.HerstellerID //top element
	
	addhistory ("Hersteller/" + hersteller_id + "/" + hersteller_name.replace("/","-") + ".html")
	document.getElementById("leftmenu_selectedbrand").style.opacity="0"
	document.getElementById("leftmenu_selectedbrand").style.filter="0"
	document.getElementById("leftmenu_selectedbrand").FadeState=-2
	if (element_id) LinkLoading(element_id)
	loadSeries(hersteller_id,loggeduser)
	
}

function FadeSeries()
{
	if (fadeSeriesTO) clearTimeout(fadeSeriesTO)
	document.getElementById("leftmenu_selectedbrand_link").innerHTML=Encoder.htmlEncode(hersteller_name)
	document.getElementById("leftmenu_selectedbrand_link").onclick=function() {
		move_menue(this,hersteller_id);
	}
	document.getElementById("leftmenu_selectedbrand_link").title=hersteller_name + " Uhren online kaufen" 
	document.getElementById("leftmenu_selectedbrand_link").href=hersteller_name + "-uhren-" + hersteller_id + ".html"
	
	TimeToFade = 800	
    setTimeout("fade('leftmenu_selectedbrand')",10)
    setTimeout("fade('serien_menu_container_left')",100)
    setTimeout("fade('serien_menu_controls')",100)
    i=1
	while (document.getElementById("serien_menu_brick_" + i)){
			document.getElementById("serien_menu_brick_" + i).style.opacity="0"
			document.getElementById("serien_menu_brick_" + i).style.filter="0"
			document.getElementById("serien_menu_brick_" + i).FadeState=-2
			fadeSeriesTO=setTimeout("fade('serien_menu_brick_" + i + "');",50*i)
			i=i+1
	}		
	setTimeout("isMoving=0",1500)
}

function showFilter(nr,e) {
	if (e) e.href='javascript:void(0)';
	if (isMoving==1) return;
	
	cDivID='filter_dropdown_' + nr
	if (document.getElementById(cDivID).offsetHeight>1) {
		HideDivMove(cDivID,0)
		//setTimeout("useFilter(" + nr + ")",300)
		return;
	}
	
	for (var i=1; i<6; i++) {
		if ((document.getElementById('filter_dropdown_' + i).offsetHeight>1) && (i!=nr)) {
			//setTimeout("useFilter(" + i + ")",300)
			HideDivMove('filter_dropdown_' + i,0)
		}
	}
	
	if (document.getElementById('filter_dropdown_' + nr).innerHTML.length>50) {
		objpos=ObjectPosition(document.getElementById('filter_' + nr))
		objLeft=objpos[0]//-document.getElementById('shop').offsetLeft
		document.getElementById('filter_dropdown_' + nr).style.left=objLeft-25 + "px"
		document.getElementById('filter_dropdown_' + nr).style.top=objpos[1]+33 + "px"
		document.getElementById('filter_dropdown_' + nr).style.height="auto"
		document.getElementById('filter_dropdown_' + nr).style.display="block"
		tmp=document.getElementById('filter_dropdown_' + nr).offsetHeight
		document.getElementById('filter_dropdown_' + nr).style.height="0px"
		openDivMove ('filter_dropdown_' + nr,tmp)
	}else{
		objpos=ObjectPosition(document.getElementById('filter_' + nr))
		objLeft=objpos[0]//-document.getElementById('shop').offsetLeft
		
		document.getElementById('filter_dropdown_' + nr).style.left=objLeft-25 + "px"
		document.getElementById('filter_dropdown_' + nr).style.top=objpos[1]+33 + "px"
		document.getElementById('filter_dropdown_' + nr).style.height="auto"
		document.getElementById('filter_dropdown_' + nr).style.display="block"
		tmp=document.getElementById('filter_dropdown_' + nr).offsetHeight
		document.getElementById('filter_dropdown_' + nr).style.height="0px"
		openDivMove ('filter_dropdown_' + nr,200,40)
		setTimeout(function(){
			URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getfilter&filter=' + nr + '&searchTXT=' + searchTXT + '&serie=' + serien_id,1)
		},100)
	}
}

function useFilter(nr,e){
	if (e) LinkLoading(e)
	cDivID='filter_dropdown_' + nr
	if (document.getElementById(cDivID).offsetHeight>1) {
		HideDivMove(cDivID,0)
	}
	filtersqlName=document.forms["filterform_" +nr].elements["filtersql_"+nr].value
	filtersqlValue=""
	switch (filtersqlName) {
	
	case "preis":
		slidermin=document.getElementById("slidermin_" +nr).value
		slidermax=document.getElementById("slidermax_" +nr).value
		divUpPos=document.getElementById("sDIVup_" +nr).offsetTop
		divDownPos=document.getElementById("sDIVdown_" +nr).offsetTop
		
		sliderValue1=Math.round(((slidermax-slidermin)/140*(140-divDownPos))+(1*slidermin))
		sliderValue2=Math.round(((slidermax-slidermin)/140*(140-divUpPos))+(1*slidermin))
		if (divDownPos>130) sliderValue1=0
		if (divUpPos<10) sliderValue2=slidermax*2
		filtersqlValue=sliderValue1 + ";" + sliderValue2
		document.getElementById("filter_label_" +nr).innerHTML=sliderValue1 + "&euro;-" + sliderValue2 + "&euro;"
		if (sliderValue1==0) document.getElementById("filter_label_" +nr).innerHTML="max. " + sliderValue2 + "&euro;"
		if (sliderValue2==slidermax*2) document.getElementById("filter_label_" +nr).innerHTML="min. " + sliderValue1 + "&euro;"
		break;

	case "durchmesser_x":
		slidermin=document.getElementById("slidermin_" +nr).value
		slidermax=document.getElementById("slidermax_" +nr).value
		divUpPos=document.getElementById("sDIVup_" +nr).offsetTop
		divDownPos=document.getElementById("sDIVdown_" +nr).offsetTop
		
		sliderValue1=Math.round(((slidermax-slidermin)/140*(140-divDownPos))+(1*slidermin))
		sliderValue2=Math.round(((slidermax-slidermin)/140*(140-divUpPos))+(1*slidermin))
		if (divDownPos>130) sliderValue1=0
		if (divUpPos<10) sliderValue2=slidermax*2
		filtersqlValue=sliderValue1 + ";" + sliderValue2
		document.getElementById("filter_label_" +nr).innerHTML=sliderValue1 + "mm-" + sliderValue2 + "mm"
		if (sliderValue1==0) document.getElementById("filter_label_" +nr).innerHTML="max. " + sliderValue2 + "mm"
		if (sliderValue2==slidermax*2) document.getElementById("filter_label_" +nr).innerHTML="min. " + sliderValue1 + "mm"
		break;
		
	default:
		document.getElementById("filter_label_" +nr).innerHTML=""	
		//finde selektierte Elemente	
		for (i=0; i<document.forms["filterform_" +nr].elements["filterradio_"+nr].length; i++){
			if (document.forms["filterform_" +nr].elements["filterradio_"+nr][i].checked==true){
				filtersqlValue+=document.forms["filterform_" +nr].elements["filterradio_"+nr][i].value + ";"
				document.getElementById("filter_label_" +nr).innerHTML+=document.forms["filterform_" +nr].elements["filterradio_"+nr][i].alt + ","
			}
			
		}
		if (document.forms["filterform_" +nr].elements["filterradio_"+nr].length==undefined) {
			//nur ein Element
			if (document.forms["filterform_" +nr].elements["filterradio_"+nr].checked==true){
				filtersqlValue+=document.forms["filterform_" +nr].elements["filterradio_"+nr].value + ";"
				document.getElementById("filter_label_" +nr).innerHTML+=document.forms["filterform_" +nr].elements["filterradio_"+nr].alt + ","
			}
		}
		//label schreiben
		tmp=document.getElementById("filter_label_" +nr).innerHTML.length-1
		if (tmp>15) {
			document.getElementById("filter_label_" +nr).innerHTML=document.getElementById("filter_label_" +nr).innerHTML.substring(0,15) + "..."
		}else{
			document.getElementById("filter_label_" +nr).innerHTML=document.getElementById("filter_label_" +nr).innerHTML.substring(0,tmp)
		}	
		if (document.getElementById("filter_label_" +nr).innerHTML=="") document.getElementById("filter_label_" +nr).innerHTML="Alle +"
		break;
	}
	
	if (document.getElementById("models_block_middle_S").style.display=="none") {
		if (filtersqlValue=="") return
		//openDivMove('models_block_middle_S',100,50)
	}
	fade('models_block_middle_S')
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=searchproduct&searchTXT=' + searchTXT + '&serie=' + serien_id + '&filterID=' + nr + '&filtersqlName=' + filtersqlName + '&filtersqlValue=' + filtersqlValue)	
	
}

function clearFilter(e){
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=clearfilter',1)
}

function getCityBRD(PLZ,id) {
	if (PLZ.length==5) {
		id.value ="searching"
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getCity&PLZ='+PLZ,1)
	}
}

function PDFnotready(e){
	if (e) e.href='javascript:void(0)';
	msgbox("Bitte warten Sie bis Ihr Dokument fertig generiert wurde.\nDies sollte im Regelfall nicht länger als 30 Sekunden dauern")
}

function ShowCashNext(cStep){

	if (!(LastMoveElement)) LastMoveElement="M1"
	tmp=WriteBackData(cStep)
	if ((isMoving==1) || (tmp!=1)) return;
	isMoving=1
	DivID="M"+cStep
	HideCashDiv()
	if (document.getElementById('cashbox_' + DivID).style.display!="block") {
		document.getElementById('cashbox_' + DivID).style.display="block"
		document.getElementById('cashbox_' + DivID).FadeState = -2
		document.getElementById('cashbox_' + DivID).style.opacity="0"
		setTimeout("fade('cashbox_" + DivID + "')",100)
	}
	if (document.getElementById("orderpdf") && (document.getElementById("orderpdf").style.opacity!="0.4")){
		document.getElementById("orderpdf").style.opacity="0.4"
		document.getElementById("orderpdf").target="_self"
		document.getElementById("orderpdf").href="#"
		document.getElementById("orderpdf").onclick=function() {
			PDFnotready(this)
		}
	}

	if (cStep==16) {
		URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getuserdata',1)
	}else{
		ShowCashDiv(DivID)
	}

	//setTimeout("isMoving=0",1500)
	
}

function radioWert(rObj) {
	for (var i=0; i<rObj.length; i++) {
		if (rObj[i].checked) return rObj[i].value;
	}
	return false;
}


function VerifyDate(obj,silent) {
	if (obj){
		document.getElementById(obj).style.backgroundColor=""
		sourceVal=document.getElementById(obj).value.replace (/\s/g, '')
		splitter= new Array("." , "," , "-" , "/" , "\\")
		tmp=""
		i=0
		
		while ((i<splitter.length) && (tmp=="")){ 
			
			tmpSplit=sourceVal.split(splitter[i])
	
			if(tmpSplit.length==3) {
				if (tmpSplit[0].length==4){
					if ((tmpSplit[2]<=31) && (tmpSplit[2]>=1) && (tmpSplit[2]!="")) tmp=tmpSplit[2]
					if ((tmpSplit[1]<=12) && (tmpSplit[1]>=1) && (tmpSplit[1]!="")) tmp+="." +tmpSplit[1]
					if ((tmpSplit[0]<=2100) && (tmpSplit[0]>=1900) && (tmpSplit[0]!=""))  tmp+="." +tmpSplit[0]
				}
				if (tmpSplit[2].length==4){
					if ((tmpSplit[0]<=31) && (tmpSplit[0]>=1) && (tmpSplit[0]!="")) tmp=tmpSplit[0]
					if ((tmpSplit[1]<=12) && (tmpSplit[1]>=1) && (tmpSplit[1]!="")) tmp+="." +tmpSplit[1]
					if ((tmpSplit[2]<=2100) && (tmpSplit[2]>=1900) && (tmpSplit[2]!=""))  tmp+="." +tmpSplit[2]
				}
			}
			if(tmpSplit.length==2) {
				if (tmpSplit[0].length==4){
					if ((tmpSplit[1]<=12) && (tmpSplit[1]>=1) && (tmpSplit[1]!="")) tmp="01."+tmpSplit[1]
					if ((tmpSplit[0]<=2100) && (tmpSplit[0]>=1900) && (tmpSplit[0]!="")) tmp+="." +tmpSplit[0]
				}
				if (tmpSplit[1].length==4){
					if ((tmpSplit[0]<=12) && (tmpSplit[0]>=1) && (tmpSplit[0]!="")) tmp="01."+tmpSplit[0]
					if ((tmpSplit[1]<=2100) && (tmpSplit[1]>=1900) && (tmpSplit[1]!=""))  tmp+="." +tmpSplit[1]
				}
			}
			if(tmpSplit.length==1) {
				if (tmpSplit[0].length==4){
					if ((tmpSplit[0]<=2100) && (tmpSplit[0]>=1900) && (tmpSplit[0]!="")) tmp="01.01."+tmpSplit[0]
				}
			}	
			//prüfen ob es ein ordentliches Datum ist...
			tmpEU=tmp.split(".")
			if ((tmp=="") || (tmpEU.length!=3)) tmp=""
			i++;
		}
		if (tmp=="") document.getElementById(obj).style.backgroundColor="#ffeeee"
		if (silent!=1) {
			document.getElementById(obj).value=tmp
			document.getElementById(obj).focus()
		}
		if (tmp!="") {
			tmpEUdate=new Date(tmpEU[2],tmpEU[1]-1,tmpEU[0])
			jetzt=new Date()
			timediff=(Math.abs(tmpEUdate.getTime() - jetzt.getTime()))
			tage=Math.floor(timediff / (1000 * 60 * 60 * 24))
			if ((obj=="SQL_anschriftseit") && (tage>365*2)) {
				document.getElementById("voranschrift").style.display="none"
			}
			if ((obj=="SQL_anschriftseit") && (tage<365*2)) {
				document.getElementById("voranschrift").style.display="block"
			}
		}
	}
}

function WriteBackData(cStep){

	nfoText=""
	tmp=LastMoveElement
	//if (document.getElementById('cashbox_infofield_M'+cStep)) document.getElementById('cashbox_infofield_M'+cStep).innerHTML=document.getElementById('cashbox_infofield_'+cStep+'_1').value + "<br>" + document.getElementById('cashbox_infofield_'+cStep+'_1').value
	
	if ((tmp==null) || (tmp==undefined)) return 1;
	
	urlStr=""
	if (document.getElementById('cashbox_'+tmp)) {
		TabTxt=document.getElementById('cashbox_block_top_h2_'+tmp).innerHTML
		urlStr+=escape(TabTxt)+"|"
		elCount=document.getElementById('cashbox_'+tmp).getElementsByTagName('input').length

		for (i=elCount-1; i>=0;i--){
			pv=document.getElementById('cashbox_'+tmp).getElementsByTagName('input')[i].id
			pt=document.getElementById('cashbox_'+tmp).getElementsByTagName('input')[i].value
			pc=document.getElementById('cashbox_'+tmp).getElementsByTagName('input')[i].checked
			py=document.getElementById('cashbox_'+tmp).getElementsByTagName('input')[i].type
			pok=1
			if (py=="radio"){
				if (pc!=true) pok=0
			}
			if ((pv=="SQL_Extra") && (pok==0)){
				pv="SQL_noExtra"
				pok=1
			}
				
			
			if ((pok==1) && (pv.indexOf("SQL")!=-1)){
				urlStr+=escape(pv) + "|" + escape(pt) + "|"
				//wenn ein Element leer ist
				if (pt==""){
					//wenn es ein Info Feld gibt
					pvtmp=pv.replace("SQL_","")
					if (document.getElementById(pvtmp+'NFO')) nfoText=document.getElementById(pvtmp+'NFO').value
				}
			}
		}	
		elCount=document.getElementById('cashbox_'+tmp).getElementsByTagName('span').length
		for (i=0; i<elCount;i++){
			pv=document.getElementById('cashbox_'+tmp).getElementsByTagName('span')[i].id
			pt=document.getElementById('cashbox_'+tmp).getElementsByTagName('span')[i].innerHTML
			if (pv.indexOf("SQL")!=-1) urlStr+=escape(pv) + "|" + escape(pt) + "|"
		}	
	}
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=writebackdata&info=' + urlStr,1)	

	tmp2=LastMoveElement.replace("M","")
	if ((nfoText=="") || (tmp2*1>cStep*1)){
		if (document.getElementById('cashbox_M'+cStep)) {
			//setTimeout(function(){
			//	smoothScroll('cashbox_M'+cStep,1,-70)
			//},1000)
		}
		return 1;
		document.getElementById('cashbox_infofield_'+cStep).style.color="#888888"
	}else{
		//alert(LastMoveElement + " hie:" + nfoText)
		document.getElementById('cashbox_infofield_'+LastMoveElement).innerHTML=nfoText
		document.getElementById('cashbox_infofield_'+LastMoveElement).style.color="maroon"
	}

}

function WriteSummary(){
	sum1=document.getElementById('anrede').innerHTML + "&nbsp;" + document.getElementById('vorname').value + "&nbsp;" + document.getElementById('nachname').value + "<br/>"
	sum1=sum1+document.getElementById('strasse').value + "&nbsp;" + document.getElementById('hausnr').value + "<br/>"
	sum1=sum1+document.getElementById('plz').value + "&nbsp;" + document.getElementById('ort').value + "<br/>"
	sum1=sum1+document.getElementById('land').innerHTML + "<br/>"
	document.getElementById('sum1').innerHTML=sum1
	
	sum2=document.getElementById('versand_anrede').innerHTML + "&nbsp;" + document.getElementById('Versand_nachname').value + "<br/>"
	sum2=sum2+document.getElementById('Versand_strasse').value + "&nbsp;" + document.getElementById('Versand_hausnr').value + "<br/>"
	sum2=sum2+document.getElementById('Versand_plz').value + "&nbsp;" + document.getElementById('Versand_ort').value + "<br/>"
	sum2=sum2+document.getElementById('Versand_land').innerHTML + "<br/>"
	document.getElementById('sum2').innerHTML=sum2
	
	document.getElementById('sum3').innerHTML=document.getElementById('telefon').value
	document.getElementById('sum4').innerHTML=document.getElementById('handy').value
	document.getElementById('sum5').innerHTML=document.getElementById('email').value
	
	document.getElementById('sum6').innerHTML=document.getElementById('geburtsdatum').value
	document.getElementById('sum7').innerHTML=document.getElementById('geburtsort').value
	document.getElementById('sum8').innerHTML=document.getElementById('ausweisnummer').value
	document.getElementById('sum9').innerHTML=document.getElementById('behoerde').value
	document.getElementById('sum10').innerHTML=document.getElementById('ausstellungsdatum').value
	document.getElementById('sum11').innerHTML=document.getElementById('familienstand').innerHTML
	
	document.getElementById('sum12').innerHTML=document.getElementById('arbeit').innerHTML
	document.getElementById('sum13').innerHTML=document.getElementById('arbeitgeber').value
	document.getElementById('sum14').innerHTML=document.getElementById('jobseit').value
	document.getElementById('sum15').innerHTML=document.getElementById('einkommen').value + " EUR"
	document.getElementById('sum16').innerHTML=document.getElementById('einkommensonst').value + " EUR"
	document.getElementById('sum17').innerHTML=document.getElementById('Miete').value + " EUR"
	document.getElementById('sum18').innerHTML=document.getElementById('wohnung').innerHTML
	
	document.getElementById('sum19').innerHTML=document.getElementById('bankname').value
	document.getElementById('sum20').innerHTML=document.getElementById('banknummer').value
	document.getElementById('sum21').innerHTML=document.getElementById('kontonummer').value
	
	i=radioWert(document.zahlarten.Zahlung)
	if(i!=false)
	document.getElementById('sum22').innerHTML=document.getElementById(['ZahlungStr'+i]).innerHTML
}

function ResizeDiv(cDivID,movespeed){
	//if ((document.getElementById(cDivID).style.display=="none")) {
		document.getElementById(cDivID).style.display="block"
		paddingBottom = getStyle(document.getElementById(cDivID), 'paddingBottom').replace("px","")
		paddingTop = getStyle(document.getElementById(cDivID), 'paddingTop').replace("px","")
		tmp1=document.getElementById(cDivID).offsetHeight-paddingBottom-paddingTop
		//alert(tmp1)
		document.getElementById(cDivID).style.height="auto"
		tmp2=document.getElementById(cDivID).offsetHeight-paddingBottom-paddingTop
		//alert(tmp2)
		document.getElementById(cDivID).style.height=tmp1+"px"
	//	openDivMove(cDivID,tmp)
	//}else{
	//	paddingBottom = getStyle(document.getElementById(cDivID), 'paddingBottom').replace("px","")
	//	document.getElementById(cDivID).style.display="block"
	//	tmp1=document.getElementById(cDivID).offsetHeight-paddingBottom
	//	document.getElementById(cDivID).style.height="auto"
	//	tmp2=document.getElementById(cDivID).offsetHeight
	//	document.getElementById(cDivID).style.height=tmp1+"px"
		if (tmp2>tmp1){
			openDivMove(cDivID,tmp2,movespeed)
		}
		if (tmp2<tmp1){
			HideDivMove(cDivID,tmp2,movespeed)
		}		
	//}

}

function FadeShowDiv(cDivID,minsize,e,movespeed){
	if (e) e.href='javascript:void(0)';
	if (document.getElementById(cDivID).isMoving==1)	return
	
	if ((document.getElementById(cDivID).style.display=="none") || (document.getElementById(cDivID).offsetHeight==minsize)) {
		if (cDivID=="cashbox_adress_shipping") document.getElementById('cashbox_M1').style.height="auto"
		document.getElementById(cDivID).style.display="block"
		document.getElementById(cDivID).style.maxHeight="none"
		document.getElementById(cDivID).style.height="auto"
		tmp=document.getElementById(cDivID).offsetHeight
		if (minsize) {
			if (minsize>tmp) minsize=tmp
			document.getElementById(cDivID).style.height=minsize+"px"
		}else{
			document.getElementById(cDivID).style.height="1px"
			document.getElementById(cDivID).FadeState = -2
			document.getElementById(cDivID).style.opacity="0"
			fade(cDivID)
		}
		openDivMove(cDivID,tmp,movespeed)
	}else{
		if (cDivID=="cashbox_adress_shipping") document.getElementById('cashbox_M1').style.height="auto"
		if (minsize) {
			HideDivMove(cDivID,minsize,movespeed)
		}else{
			document.getElementById(cDivID).FadeState = 2
			document.getElementById(cDivID).style.opacity="1"
			fade(cDivID)
			HideDivMove(cDivID,0,movespeed)
			//setTimeout("document.getElementById('" + cDivID + "').style.display='none'",500)
		}
		
	}

}

function ChangeOrderMethod(om){
	document.bestellarten.order[om-1].checked = true
	switch (om){
	case "1":
		document.getElementById('cashbox_bar_bottom_link1_M4').onclick=function() {
			this.href="javascript:void(0);"
			ShowCashNext('5');
		}
		document.getElementById('cashbox_bar_bottom_link1_M4').innerHTML="... weiter zur <b>Arbeit &amp; Einkommen</b> ..."
		divs= new Array("M17","M18")
		for (var i=0; i<=divs.length-1; i++) {
			if (document.getElementById('cashbox_' + divs[i]).style.display=="block") {
				document.getElementById('cashbox_' + divs[i]).FadeState = 2
				document.getElementById('cashbox_' + divs[i]).style.opacity="1"
				setTimeout("fade('cashbox_" + divs[i] + "')",100)
				setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='none'",200)
			}
		}
		//divs= new Array("M5","M6")
		//for (var i=0; i<=divs.length-1; i++) {
		//	if (document.getElementById('cashbox_' + divs[i]).style.display=="none") {
		//		document.getElementById('cashbox_' + divs[i]).FadeState = -2
		//		document.getElementById('cashbox_' + divs[i]).style.opacity="0"
		//		setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='block'",100*i)
		//		setTimeout("fade('cashbox_" + divs[i] + "')",300+100*i)
		//	}
		//}
		break;
		
	case "4":
		document.getElementById('cashbox_bar_bottom_link1_M4').onclick=function() {
			this.href="javascript:void(0);"
			ShowCashNext('18');
		}
		document.getElementById('cashbox_bar_bottom_link1_M4').innerHTML="... <b>Dokumenten</b> anfordern ..."
		divs= new Array("M5","M6","M10","M16","M17")
		for (var i=0; i<=divs.length-1; i++) {
			if (document.getElementById('cashbox_' + divs[i]).style.display=="block") {
				document.getElementById('cashbox_' + divs[i]).FadeState = 2
				document.getElementById('cashbox_' + divs[i]).style.opacity="1"
				setTimeout("fade('cashbox_" + divs[i] + "')",100)
				setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='none'",200)
			}
		}
		break;
	default:
		document.getElementById('OrderMethod1') .style.display="none"
		document.getElementById('OrderMethod2') .style.display="none"
		if (om==2) document.getElementById('OrderMethod1') .style.display="block"
		if (om==3) document.getElementById('OrderMethod2') .style.display="block"
		document.getElementById('cashbox_bar_bottom_link1_M4').onclick=function() {
			this.href="javascript:void(0);"
			ShowCashNext('17');
		}		
		document.getElementById('cashbox_bar_bottom_link1_M4').innerHTML="... weiter zu den <b>Dokumenten</b> ..."	
		divs= new Array("M5","M6","M10","M16","M17","M18")
		for (var i=0; i<=divs.length-1; i++) {
			if (document.getElementById('cashbox_' + divs[i]).style.display=="block") {
				document.getElementById('cashbox_' + divs[i]).FadeState = 2
				document.getElementById('cashbox_' + divs[i]).style.opacity="1"
				setTimeout("fade('cashbox_" + divs[i] + "')",100)
				setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='none'",200)
			}
		}
	}
}
function ChangeShippingMethod(e,sm){
	if (e) e.href='javascript:void(0)';
	for (i=0;i<document.Versandarten.Versand.length;i++){	 
		if (document.Versandarten.Versand[i].value==sm) document.Versandarten.Versand[i].checked = true
	}
}

function ChangePayMethod(e,pm){
	if (e) e.href='javascript:void(0)';
		
	for (i=0;i<document.zahlarten.Zahlung.length;i++){	 
		if (document.zahlarten.Zahlung[i].value==pm) document.zahlarten.Zahlung[i].checked = true
	}
	switch (pm){
		case "11": //finanzierung
			document.getElementById('cashbox_bar_bottom_link1_M2').onclick=function() {
				this.href="javascript:void(0);"
				ShowCashNext('3');
			}
			document.getElementById('cashbox_bar_bottom_link1_M2').innerHTML="... weiter zur <b>Laufzeit &amp; Anzahlung</b> ..."
			divs= new Array("M10","M16","M17")
			for (var i=0; i<=divs.length-1; i++) {
				if (document.getElementById('cashbox_' + divs[i]).style.display=="block") {
					document.getElementById('cashbox_' + divs[i]).FadeState = 2
					document.getElementById('cashbox_' + divs[i]).style.opacity="1"
					setTimeout("fade('cashbox_" + divs[i] + "')",100)
					setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='none'",200)
				}
			}
			document.getElementById('cashbox_block_top_h4_M2').innerHTML="Schritt 2 von 8"
			document.getElementById('cashbox_block_top_h4_M10').innerHTML="Schritt 7 von 8"
			document.getElementById('cashbox_block_top_h4_M16').innerHTML="Schritt 8 von 8"
			document.getElementById('cashbox_block_middle_row_pay1').style.display="block"
			document.getElementById('cashbox_block_middle_row_pay2').style.display="block"
			break;
		default:
			document.getElementById('cashbox_bar_bottom_link1_M2').onclick=function() {
				this.href="javascript:void(0);"
				ShowCashNext('10');
			}		
			document.getElementById('cashbox_bar_bottom_link1_M2').innerHTML="... weiter zu den <b>Versandarten</b> ..."	
			divs= new Array("M3","M4","M5","M6","M10","M16","M17")
			for (var i=0; i<=divs.length-1; i++) {
				if (document.getElementById('cashbox_' + divs[i]).style.display=="block") {
					document.getElementById('cashbox_' + divs[i]).FadeState = 2
					document.getElementById('cashbox_' + divs[i]).style.opacity="1"
					setTimeout("fade('cashbox_" + divs[i] + "')",100)
					setTimeout("document.getElementById('cashbox_" + divs[i] + "').style.display='none'",200)
				}
			}
			document.getElementById('cashbox_block_top_h4_M2').innerHTML="Schritt 2 von 4"
			document.getElementById('cashbox_block_top_h4_M10').innerHTML="Schritt 3 von 4"
			document.getElementById('cashbox_block_top_h4_M16').innerHTML="Schritt 4 von 4"
			document.getElementById('cashbox_block_middle_row_pay1').style.display="none"
			document.getElementById('cashbox_block_middle_row_pay2').style.display="none"
		}
}


function ShowCashDiv(DivID) {
	document.getElementById('cashbox_' + DivID).style.height="auto"
	document.getElementById('cashbox_' + DivID).style.display="block"
	
	document.getElementById('cashbox_block_middle_' + DivID).style.height="auto"
	tmp=document.getElementById('cashbox_block_middle_' + DivID).offsetHeight
	paddingBottom = getStyle(document.getElementById('cashbox_block_middle_' + DivID), 'paddingBottom').replace("px","")
	paddingTop = getStyle(document.getElementById('cashbox_block_middle_' + DivID), 'paddingTop').replace("px","")
	document.getElementById('cashbox_block_middle_' + DivID).style.height="1px"
	openDivMove('cashbox_block_middle_' + DivID,tmp-paddingBottom-paddingTop,3)
			
	fade('cashbox_block_top_h2_' + DivID)
	fade('cashbox_block_top_h4_' + DivID)
	document.getElementById('cashbox_bar_bottom_link2_' + DivID).style.display="none"
	document.getElementById('cashbox_bar_bottom_link1_' + DivID).style.display="block"
	LastMoveElement=DivID
}

function HideCashDiv(DivID) {
	if (LastMoveElement){ 
		DivID=LastMoveElement
	}else{
		return;
	}
	HideDivMove('cashbox_block_middle_' + DivID,1,3)
	
	fade('cashbox_block_top_h2_' + DivID)
	fade('cashbox_block_top_h4_' + DivID)
	document.getElementById('cashbox_bar_bottom_link1_' + DivID).style.display="none"
	document.getElementById('cashbox_bar_bottom_link2_' + DivID).style.display="block"
}

function ObjectPosition(obj) {
	if (obj){
	    var curleft = 0;
	      var curtop = 0;
	      if (obj.offsetParent) {
	            do {
	            	//alert("obj.id:" + obj.id + "|obj.offsetLeft:" + obj.offsetLeft)
	                  curleft += obj.offsetLeft;
	                  curtop += obj.offsetTop;
	            } while (obj = obj.offsetParent);
	      }
	      return [curleft,curtop];
	}
}

function ShowProducts(eid,items,e,herstellerID,SerieID,ModellID,isadmin,smlimit){
	if (e) e.href='javascript:void(0)';
	if (document.getElementById('models_block_middle_slide_' + eid).offsetHeight!=85) {
		HidelProducts(eid,items,e,herstellerID,SerieID,ModellID,isadmin)
		return;
	}
	
	if ((cid!=0) && (cid!=eid)) {
		HidelProducts(cid,citems,lastE,hersteller_id,serien_id,Modell_id)
	}
	slideTab=0
	
	lastE=e
	hersteller_id=herstellerID
	serien_id=SerieID
	Modell_id=ModellID
	citems=items
	fullPrice=null
	if (smlimit==undefined) smlimit=18
	if (parseInt(citems)>parseInt(smlimit)) citems=smlimit
	mh=Math.ceil(citems/6)*152+20	
	tMo1 = new Tween(document.getElementById('models_block_middle_slide_' + eid).style,'height',Tween.strongEaseOut,document.getElementById('models_block_middle_slide_' + eid).offsetHeight,mh,1.5,'px');
	tMo1.start()
	
	
    if (document.getElementById('fmore_' + eid)){
		document.getElementById('fless_' + eid).innerHTML=""
		document.getElementById('fmore_' + eid).style.display="block"
		rightpos=(document.getElementById("fright_" + herstellerID + SerieID + ModellID).offsetLeft-574)*-1
		tR = new Tween(document.getElementById("fright_" + herstellerID + SerieID + ModellID).style,'right',Tween.strongEaseInOut,rightpos,0,1,'px');
		tR.start()	    
		maxTab=1
		while (document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_" +maxTab)){ 
			document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_" + maxTab).style.fontWeight="normal"
			document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_" + maxTab).style.fontSize="12px"
			maxTab++
		}
		if (document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_1")) {
			document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_1").style.fontWeight="bold"
			document.getElementById("fmore_" + herstellerID + SerieID + ModellID + "_1").style.fontSize="15px"
		}

	}else{
		e.innerHTML="Ansicht <b>schliessen</b>"
	}
	cid=eid
}

function HidelProducts(eid,items,e,herstellerID,SerieID,ModellID,isadmin){
	if (!e) return
	if (e) e.href='javascript:void(0)';
	e.innerHTML="alle Modelle <b>anzeigen</b>"
	if (!document.getElementById('models_bar_bottom_link_' + cid)) return;
	cid=eid
	if (document.getElementById("models_block_middle_slide_" + herstellerID + SerieID + ModellID)){
		tmp=document.getElementById("models_block_middle_slide_" + herstellerID + SerieID + ModellID).offsetLeft-20
		tmp2=0
		if (tmp2!=tmp){
			t1 = new Tween(document.getElementById("models_block_middle_slide_" + herstellerID + SerieID + ModellID).style,'left',Tween.strongEaseInOut,tmp,tmp2,0.5,'px');
			t1.start()	
		}
	}
	if ((document.getElementById('fmore_' + eid)) && (document.getElementById("fleft_" + herstellerID + SerieID + ModellID))){
		document.getElementById('fmore_' + eid).style.display="none"
		tL = new Tween(document.getElementById("fleft_" + herstellerID + SerieID + ModellID).style,'left',Tween.strongEaseInOut,document.getElementById("fleft_" + herstellerID + SerieID + ModellID).offsetLeft,-117,1,'px');
		tL.start()	
		rightpos=(document.getElementById("fright_" + herstellerID + SerieID + ModellID).offsetLeft-574)*-1
		tR = new Tween(document.getElementById("fright_" + herstellerID + SerieID + ModellID).style,'right',Tween.strongEaseInOut,rightpos,-117,1,'px');
		tR.start()	    
	}	
	tMo2 = new Tween(document.getElementById('models_block_middle_slide_' + cid).style,'height',Tween.strongEaseOut,document.getElementById('models_block_middle_slide_' + cid).offsetHeight,85,1.5,'px');
	tMo2.onMotionFinished = function(){
		//document.getElementById('models_block_middle_slide_' + cid).style.display="none"
		//setTimeout("document.getElementById('models_block_middle_slide_' + cid).style.display='block';",100)
	}
	tMo2.start()
}

function ShowProductsMove(h,mh,cid,herstellerID,SerieID,ModellID){
	if ((h<mh) && (checkBrowserName()>=9)) {
		h=h+Math.round(Math.abs(h-mh)/6)+1
		setTimeout(function(){
			ShowProductsMove(h,mh,cid);
			},33)
	}else{
		h=mh
	}	
	document.getElementById('models_block_middle_slide_' + cid).style.height=h+"px"
	if (checkBrowserName()==7) document.getElementById('models_bar_bottom_' + cid).style.top=h-13 +"px"
}

function openAllRates(cPrice){	
	if (fullPrice==null) {
		fullPrice=cPrice
		actlPrice=cPrice
	}
	actlPrice
	details_info_slider_content=1
	if (document.getElementById("details_info_slider").style.height.replace("px","")=="35"){
		document.getElementById("details_info_slider").style.backgroundImage="url(../shop/gfx/theme/silver_rahmen_verhandeln.png)"
		fade("slider_show_rate")
		fade("shop_button_row")
		fade("details_price_info")
		openDivMove('details_info_slider',224)
		setTimeout("HideDivMove('details_textblock_1',30)",200)
		setTimeout("HideDivMove('details_textblock_2',30)",200)
		setTimeout("HideDivMove('details_textblock_3',30)",200)
		setTimeout("HideDivMove('details_textblock_4',30)",200)
		setTimeout("HideDivMove('shop_button_row',1)",200)
		setTimeout("HideDivMove('details_price_info',1)",200)	
	}
}

function mach_tausender(number) {
	// Info: Die '' sind zwei Hochkommas
	number = '' + number;
	if (number.length > 3) {
		var mod = number.length % 3;
		var output = (mod > 0 ? (number.substring(0,mod)) : '');
		for (i=0 ; i < Math.floor(number.length / 3); i++) {
			if ((mod == 0) && (i == 0))
				output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
			else
				// hier wird das Trennzeichen festgelegt mit '.'
				output+= '.' + number.substring(mod + 3 * i, mod + 3 * i + 3);
			}
		return (output);
	}
	else return number;
}


function closeAllRates(LZ,cPrice,e){
	if (e) e.href='javascript:void(0)';
	i=0
	while (document.getElementById('rrow_' + i + '_check')){
		document.getElementById('rrow_' + i + '_check').innerHTML=""
		i=i+1
	}
	
	
	document.getElementById(e.id + '_check').innerHTML="<<"
	
	if (fullPrice==null) {
		fullPrice=cPrice
		actlPrice=cPrice
	}
	actlLZ=LZ
	Rate3=Math.round(actlPrice/3)
	Rate6=Math.round(actlPrice/6)
	zins=0.0490
	Rate12=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,12))/(Math.pow(1+zins/12,12)-1))
	zins=0.0790
	Rate24=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,24))/(Math.pow(1+zins/12,24)-1))
	Rate36=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,36))/(Math.pow(1+zins/12,36)-1))
	zins=0.0790//0.0890
	Rate48=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,48))/(Math.pow(1+zins/12,48)-1))
	zins=0.0790//0.0990
	Rate60=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,60))/(Math.pow(1+zins/12,60)-1))
	zins=0.0790//0.1090
	Rate72=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,72))/(Math.pow(1+zins/12,72)-1))
	Rate84=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,84))/(Math.pow(1+zins/12,84)-1))	
	Rate=window["Rate" + actlLZ]
	document.getElementById('rate0').innerHTML=Rate
	document.getElementById('laufzeit').innerHTML=LZ
	document.getElementById('rate3').innerHTML=Rate3 + " &euro;"
	document.getElementById('rate6').innerHTML=Rate6 + " &euro;"
	document.getElementById('rate12').innerHTML=Rate12 + " &euro;"
	document.getElementById('rate24').innerHTML=Rate24 + " &euro;"
	document.getElementById('rate36').innerHTML=Rate36 + " &euro;"
	document.getElementById('rate48').innerHTML=Rate48 + " &euro;"
	document.getElementById('rate60').innerHTML=Rate60 + " &euro;"
	document.getElementById('rate72').innerHTML=Rate72 + " &euro;"
	document.getElementById('rate84').innerHTML=Rate84 + " &euro;"	
}

function RateDown(e){
	if (e) e.href='javascript:void(0)';
	if (RateCountActive==1) return;
	RateCountActive=1
	fullPrice=document.getElementById('fullPrice').value
	cPrice=document.getElementById('userPrice').value
	details_info_slider_content=2
	if (document.getElementById("info_middle_bottom").style.height.replace("px","")=="0"){
		if (document.getElementById("info_middle_bottom").innerHTML=="") {
			URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=showpricetrade&p_id=' + document.getElementById("productID").value,1)
			return;
		}
		fade("price_info_middle_shoppingcartbutton")
		document.getElementById('info_middle_bottom').style.display="block"
		openDivMove('info_middle_bottom',115)
		document.getElementById('price_info_middle_shoppingcartbutton').style.display="none"		
		actlPrice=cPrice
	}
	ePrice=Math.round((actlPrice*.99)-1)
	if (ePrice<=Math.round(cPrice*.20)){
		ePrice=Math.round(cPrice*.20)
	}
	//if (RateDownFB) clearTimeout(RateDownFB);
	//RateDownFB=setTimeout("URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addaction&actiontxt=down_price_request',1)",500)
	RateDownCount(ePrice)	
}

function RateDownCount(ePrice){
	if ((actlPrice>ePrice)) {
		actlPrice=Math.round((actlPrice*0.999)-1)
  		tt=setTimeout("RateDownCount(" + ePrice + ")",10)
  	}else{
  		RateCountActive=0
  		actlPrice=ePrice
  	}
	Rate6=Math.round(actlPrice/6)
	zins=0.0490
	Rate12=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,12))/(Math.pow(1+zins/12,12)-1))
	zins=0.0790
	Rate24=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,24))/(Math.pow(1+zins/12,24)-1))
	Rate36=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,36))/(Math.pow(1+zins/12,36)-1))
	zins=0.0790//0.0890
	Rate48=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,48))/(Math.pow(1+zins/12,48)-1))
	zins=0.0790//0.0990
	Rate60=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,60))/(Math.pow(1+zins/12,60)-1))
	zins=0.0790//0.1090
	Rate72=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,72))/(Math.pow(1+zins/12,72)-1))
	Rate84=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,84))/(Math.pow(1+zins/12,84)-1))	
	Rate=window["Rate" + actlLZ]
	document.getElementById('rate6').innerHTML=Rate6 + " &euro;"
	document.getElementById('rate12').innerHTML=Rate12 + " &euro;"
	document.getElementById('rate24').innerHTML=Rate24 + " &euro;"
	document.getElementById('rate36').innerHTML=Rate36 + " &euro;"
	document.getElementById('rate48').innerHTML=Rate48 + " &euro;"
	document.getElementById('rate60').innerHTML=Rate60 + " &euro;"
	document.getElementById('rate72').innerHTML=Rate72 + " &euro;"
	document.getElementById('rate84').innerHTML=Rate84 + " &euro;"		
	tmp=(1-(actlPrice/fullPrice))*100
	tmp1=Math.floor(tmp)
	tmp2=Math.floor(tmp*10-tmp1*10)
	document.getElementById('RP_proz').innerHTML=' ' + tmp1 + ',<i>' + tmp2 + '</i> %'
	document.getElementById('RP_num').innerHTML=mach_tausender(fullPrice-actlPrice)
	document.getElementById('preis').innerHTML=mach_tausender(actlPrice) + ' <span>EUR</span>'
	document.getElementById('rate0').innerHTML=Rate
}

function RateUp(e){
	if (e) e.href='javascript:void(0)';
	if (RateCountActive==1) return;
	fullPrice=document.getElementById('fullPrice').value
	cPrice=document.getElementById('userPrice').value
	details_info_slider_content=2
	if (document.getElementById("info_middle_bottom").style.height.replace("px","")=="115"){
		RateCountActive=1
		ePrice=Math.round((actlPrice*1.011)+1)
		if (ePrice>=cPrice){
			ePrice=cPrice
			HideDivMove("info_middle_bottom",0)
			fade("price_info_middle_shoppingcartbutton")
			document.getElementById('price_info_middle_shoppingcartbutton').style.display="block"
		}
		RateUpCount(ePrice)
	}
}

function RateUpCount(ePrice){
	if ((actlPrice<ePrice)){
		actlPrice=Math.round((actlPrice*1.001)+1)
  		tt=setTimeout("RateUpCount(" + ePrice + ")",10)
  	}else{
  		RateCountActive=0
  		actlPrice=ePrice
  	}
	Rate6=Math.round(actlPrice/6)
	zins=0.0490
	Rate12=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,12))/(Math.pow(1+zins/12,12)-1))
	zins=0.0790
	Rate24=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,24))/(Math.pow(1+zins/12,24)-1))
	Rate36=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,36))/(Math.pow(1+zins/12,36)-1))
	zins=0.0790//0.0890
	Rate48=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,48))/(Math.pow(1+zins/12,48)-1))
	zins=0.0790//0.0990
	Rate60=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,60))/(Math.pow(1+zins/12,60)-1))
	zins=0.0790//0.1090
	Rate72=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,72))/(Math.pow(1+zins/12,72)-1))
	Rate84=Math.round(actlPrice*((zins/12)*Math.pow(1+zins/12,84))/(Math.pow(1+zins/12,84)-1))	
	Rate=window["Rate" + actlLZ]
	document.getElementById('rate0').innerHTML="<span>oder</span> " + Rate + " &euro; <span>/mtl**</span>"
	document.getElementById('rate6').innerHTML=Rate6 + " &euro;"
	document.getElementById('rate12').innerHTML=Rate12 + " &euro;"
	document.getElementById('rate24').innerHTML=Rate24 + " &euro;"
	document.getElementById('rate36').innerHTML=Rate36 + " &euro;"
	document.getElementById('rate48').innerHTML=Rate48 + " &euro;"
	document.getElementById('rate60').innerHTML=Rate60 + " &euro;"
	document.getElementById('rate72').innerHTML=Rate72 + " &euro;"
	document.getElementById('rate84').innerHTML=Rate84 + " &euro;"
	tmp=(1-(actlPrice/fullPrice))*100
	tmp1=Math.floor(tmp)
	tmp2=Math.floor(tmp*10-tmp1*10)
	document.getElementById('RP_proz').innerHTML=' ' + tmp1 + ',<i>' + tmp2 + '</i> %'
	document.getElementById('RP_num').innerHTML=mach_tausender(fullPrice-actlPrice)
	document.getElementById('preis').innerHTML=mach_tausender(actlPrice) + ' <span>EUR</span>'
	document.getElementById('rate0').innerHTML=Rate
	
}

function addBasket(ProductID){
	if (document.getElementById('price_info_middle_shoppingcartbutton').style.opacity=="0") return;
	
	$('#hiddenclicker4').trigger('click');
	if (ProductID==undefined) ProductID=document.getElementById('productID').value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=addBasket&productID=' + ProductID,1)
	//setTimeout("parent.$.fancybox.close();",2000)
}

function noAddBasket(ProductID){
	if (document.getElementById('price_info_middle_shoppingcartbutton').style.opacity=="0") return;
	if (ProductID==undefined) ProductID=document.getElementById('productID').value
	document.getElementById("msgbox").href="..\\shop\\html\\popup_noBasket.asp?artikelID=" + ProductID
	setTimeout("$('#msgbox').trigger('click');",50)

}

function removeBasket(ProductID){
	$('#hiddenclicker4').trigger('click');
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=removeBasket&productID=' + ProductID,1)
}


function sendPriceRequest(e){
	if (e) e.href='javascript:void(0)';
	var preisemail, preistelefon, preisname
	preisemail=document.getElementById('preisemail').value
	preistelefon=document.getElementById('preistelefon').value
	preisname=document.getElementById('preisname').value	
	ProductID=document.getElementById('productID').value

	if (preisemail=="") {
		document.getElementById("msgbox").href="..\\shop\\html\\popup_preis_fail.asp?status=1"
		$('#msgbox').trigger('click');
		return;
	}
	if ((preistelefon=="") || (preisname=="")) {
		if (preistelefon=="") preistelefon="000"
		if (preisname=="") preisname="unknown customer"
		document.getElementById("msgbox").href="..\\shop\\html\\popup_preis_fail.asp"
		$('#msgbox').trigger('click');
	}else{
		document.getElementById("msgbox").href="..\\shop\\html\\popup_preis_ok.asp"
		$('#msgbox').trigger('click');
	}

	HideDivMove("info_middle_bottom",0)
	document.getElementById('price_info_middle_shoppingcartbutton').style.display="block"
	fade("price_info_middle_shoppingcartbutton")	
	cPrice=document.getElementById('userPrice').value
	RateUpCount(cPrice)
	
	if (e) LinkLoading(e)
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=preisAnfrage&email=' + escape(preisemail) + '&telefonnummer=' + escape(preistelefon) + '&name=' + escape(preisname) + '&preis=' + escape(actlPrice) + '&productID=' + ProductID,1)}

function moveDetailsTextblock(divID){
	if ((document.getElementById(LastMoveDetailsElement)) && (divID!=LastMoveDetailsElement)) HideDivMove(LastMoveDetailsElement,30)
	if (document.getElementById(divID).style.height.replace("px","")=="30"){
		//stretch to full height
		document.getElementById(divID).style.height="auto"
		//get size
		tmp=document.getElementById(divID).offsetHeight
		//close div, prepare to move slooowly to full size
		document.getElementById(divID).style.height="30px"
		openDivMove(divID,tmp)
		LastMoveDetailsElement=divID
	}else{
		HideDivMove(divID,30)
	}
}

function openDivMove(divID,mh,movespeed){
	if (document.getElementById(divID).isMoving==1)	return
	document.getElementById(divID).isMoving=1
	isMoving=1
	if (movespeed==undefined) movespeed=7
	paddingBottom = getStyle(document.getElementById(divID), 'paddingBottom').replace("px","")
	paddingTop = getStyle(document.getElementById(divID), 'paddingTop').replace("px","")
	h=document.getElementById(divID).offsetHeight-paddingBottom-paddingTop
	if ((h<mh) && (checkBrowserName()>=9)) {
		openDivMoveProcess(divID,h,mh,movespeed)
	}else{
		document.getElementById(divID).style.height=mh+"px"
		openDivMoveProcess(divID,h,mh,movespeed)
	}	
}
function openDivMoveProcess(divID,h,mh,movespeed){
	//paddingBottom = getStyle(document.getElementById(divID), 'paddingBottom').replace("px","")
	//paddingTop = getStyle(document.getElementById(divID), 'paddingTop').replace("px","")
	//h=document.getElementById(divID).offsetHeight-paddingBottom-paddingTop
	if (h<mh) {
		h=h+Math.ceil(Math.abs(h-mh)/movespeed)+1
		document.getElementById(divID).style.height=h+"px"
		divMoving=setTimeout("openDivMoveProcess('" + divID + "'," + h + "," + mh + "," + movespeed+ ")",35)
	}else{
		h=mh
		document.getElementById(divID).isMoving=0
		isMoving=0
		document.getElementById(divID).style.height=h+"px"
		if ((divID=="details_textblock_1") ||  (divID=="serien_menu_middle")) document.getElementById(divID).style.height="auto"
		if (divID.indexOf("model_")!=-1) document.getElementById(divID).style.height="auto"
		if (divID.indexOf("pinfo_con")!=-1) document.getElementById(divID).style.height="auto"
		if (divID.indexOf("more_info_")!=-1) document.getElementById(divID).style.height="auto"
		if (divID.indexOf("cashbox_block_middle_")!=-1) document.getElementById(divID).style.height="auto"
		if ((details_info_slider_content==1) && (divID=="details_info_slider")) {
			document.getElementById("slider_rate_frame").style.display="block"
			document.getElementById('slider_rate_frame').style.opacity="0"
			document.getElementById('slider_rate_frame').style.filter="0"
			document.getElementById('slider_rate_frame').FadeState=-2
			setTimeout("fade('slider_rate_frame')",100)
			document.getElementById("slider_show_rate").style.display="none"
		}
		if ((details_info_slider_content==2) && (divID=="details_info_slider")) {
			document.getElementById("slider_calc_frame").style.display="block"
			document.getElementById('slider_calc_frame').style.opacity="0"
			document.getElementById('slider_calc_frame').style.filter="0"
			document.getElementById('slider_calc_frame').FadeState=-2
			setTimeout("fade('slider_calc_frame')",100)
			document.getElementById("slider_show_rate").style.display="none"
		}
	}	
}

function HideDivMove(divID,mh,movespeed){
	if (document.getElementById(divID).isMoving==1) return
	document.getElementById(divID).isMoving=1
	isMoving=1
	if (movespeed==undefined) movespeed=7
	paddingBottom = getStyle(document.getElementById(divID), 'paddingBottom').replace("px","")
	paddingTop = getStyle(document.getElementById(divID), 'paddingTop').replace("px","")
	ch=document.getElementById(divID).offsetHeight-paddingBottom-paddingTop
	if ((ch>mh) && (checkBrowserName()>=9)) {
		HideDivMoveProcess(divID,ch,mh,movespeed)
	}else{
		document.getElementById(divID).style.height=mh+"px"
		HideDivMoveProcess(divID,ch,mh,movespeed)
	}	
}

function HideDivMoveProcess(divID,ch,mh,movespeed){
	//paddingBottom = getStyle(document.getElementById(divID), 'paddingBottom').replace("px","")
	//paddingTop = getStyle(document.getElementById(divID), 'paddingTop').replace("px","")
	//ch=document.getElementById(divID).offsetHeight-paddingBottom-paddingTop
	if (ch>mh) {
		ch=ch-Math.ceil(Math.abs(ch-mh)/movespeed)-1
		setTimeout("HideDivMoveProcess('" + divID + "'," + ch + "," + mh + "," + movespeed+ ")",35)
	}else{
		ch=mh
		document.getElementById(divID).isMoving=0
		isMoving=0
		if (mh==0) {
			document.getElementById(divID).style.display="none"
		}
		if ((details_info_slider_content==1) && (divID=="details_info_slider")) {
			fade("slider_show_rate")
			fade("shop_button_row")
			fade("details_price_info")
			document.getElementById("details_info_slider").style.backgroundImage="url(../shop/gfx/theme/silver_rahmen_verhandeln_klein.png)"		
			document.getElementById("slider_show_rate").style.display="block"
		}
		if ((details_info_slider_content==2) && (divID=="details_info_slider")) {
			fade("slider_show_rate")
			fade("shop_button_row")
			fade("details_price_info")
			document.getElementById("details_info_slider").style.backgroundImage="url(../shop/gfx/theme/silver_rahmen_verhandeln_klein.png)"		
			document.getElementById("slider_show_rate").style.display="block"
		}
	}	
	document.getElementById(divID).style.height=ch+"px"
	if (divID.indexOf("searchResult")!=-1) document.getElementById(divID).style.height="auto"
}


function getStyle(elem, name) {
    // J/S Pro Techniques p136
    if (elem.style[name]) {
        return elem.style[name];
    } else if (elem.currentStyle) {
        return elem.currentStyle[name];
    }
    else if (document.defaultView && document.defaultView.getComputedStyle) {
        name = name.replace(/([A-Z])/g, "-$1");
        name = name.toLowerCase();
        s = document.defaultView.getComputedStyle(elem, "");
        return s && s.getPropertyValue(name);
    } else {
        return null;
    }
}


function HidelProductsMove(h,mh,cid){
	if (!document.getElementById('models_block_middle_slide_' + cid)) return;
	
	if (h==0) h=document.getElementById('models_block_middle_slide_' + cid).style.height.replace("px","")
	if ((h>mh) && (checkBrowserName()>=9)) {
		h=h-Math.round(Math.abs(h-mh)/6)-1
		setTimeout(function(){
			HidelProductsMove(h,mh,cid);
			},33)
	}else{
		h=mh
	}	
	document.getElementById('models_block_middle_slide_' + cid).style.height=h+"px"
	if (checkBrowserName()==7) document.getElementById('models_bar_bottom_' + cid).style.top=h-31 +"px"
}

function ShowModells(eid,hersteller_id,hersteller_name,serien_id){
	if (eid) eid.href='javascript:void(0)';
	if (isMoving==1) return;
	document.getElementById('serien_menu_controls_filter').style.display="block"
	document.getElementById('serien_menu_controls').style.display="none"

	TimeToFade = 100
	document.getElementById('display_area_content').style.opacity="1"
	document.getElementById('display_area_content').style.filter="100"
	document.getElementById('display_area_content').FadeState=2
	fade('display_area_content')	
	
	TimeToFade = 200
	window.serien_id=serien_id
	window.serien_name=eid.innerHTML

	window.hersteller_id=hersteller_id
	window.hersteller_name=hersteller_name
	
	addhistory ("Hersteller/" + hersteller_id + "/" + hersteller_name.replace("/","-") + "/Serie/" + serien_id + "/" + serien_name.replace("/","-") + ".html")
	setTimeout("URLRequest('http://www.uhrenlounge.de/shop/html/ajax_serien.asp?hid="+ hersteller_id + "&sid=' + serien_id);",100)	
	for (var i=1; i<6; i++) {
		document.getElementById('filter_dropdown_' + i).innerHTML=""
		document.getElementById("filter_label_" +i).innerHTML="Alle +"
	}
}

/*function pvariant(Typ,ValueID,ValueID2){
	if (isMoving==1) return;
	if (document.getElementById(LastMoveElement + '_open')) {
		document.getElementById(LastMoveElement + '_close').style.display="block"	
		HideDivMove(LastMoveElement + '_frame',16)
		document.getElementById(LastMoveElement + '_show_more').innerHTML="+"
		
	}
	if (document.getElementById("info_middle_bottom").style.height.replace("px","")=="115"){
		HideDivMove("info_middle_bottom",0)
		fade("price_info_middle_shoppingcartbutton")
	}
	ProductID=document.getElementById('productID').value
	URLRequest('http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getvariant&typ=' + Typ + '&productID=' + ProductID + '&valueID=' + ValueID + '&valueID2=' + ValueID2)
}*/

function show_all_series()
{
   i=6
   while (document.getElementById("serien_menu_brick_" + i)){
			if (checkBrowserName()>=8) {
				document.getElementById("serien_menu_brick_" + i).style.display="table"	
			}else{
				document.getElementById("serien_menu_brick_" + i).style.display="block"		
			}
			setTimeout("fade('serien_menu_brick_" + i + "');",100*i-600)
			i=i+1
	}
	//setTimeout("fade('serien_menu_brick_A');",1)
	//setTimeout("document.getElementById('serien_menu_brick_A').style.display='none'",500)
	document.getElementById('controls_middle').innerHTML="Bitte <b>wählen</b> Sie eine <b>" + hersteller_name + "-Serie</b> aus"
	document.getElementById('controls_middle').onclick=""
	document.getElementById('controls_middle').onmouseover=""
	document.getElementById('controls_middle').onmouseout=""
}

function checkBrowserName(){  
	
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
	 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
	 if (ieversion>=9)
	  return 9
	 else if (ieversion>=8)
	  return 8
	 else if (ieversion>=7)
	  return 7
	 else if (ieversion>=6)
	  return 6
	 else if (ieversion>=5)
	  return 5
	} else {
	  return 10
	}
}  

function loadSeries(hersteller_id,loggeduser){
	if (loading==1) {
		setTimeout(function(){
			loadSeries(hersteller_id,loggeduser);
		},250)
		return;
	}
	if (loggeduser==undefined) loggeduser=0
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getseries&brand=" + hersteller_id + "&loggeduser=" + loggeduser,1)
}

function loadModells(Serien_id){
	if (loading==1) {
		setTimeout(function(){
			loadModells(Serien_id);
		},250)
		return;
	}
	URLRequest("http://www.uhrenlounge.de/shop/asp/ajaxSQL.asp?action=getmodells&serie=" + Serien_id)
}

function loadBasket(){
	if (loading==1) {
		setTimeout(function(){
			loadBasket();
		},250)
		return;
	}
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_warenkorb.asp?x=1')
}

function loadAJAX(page,e,SSL)
{
	if (e) LinkLoading(e)
	//page=warenkorb || page=kasse
	LastMoveElement=null
	addhistory (page + ".html")
	if ((SSL=="SSL") && (document.location.protocol!="https:")) {
		document.location="https://www.uhrenlounge.de/shop/?hash=1#kasse.html"
	}else{
		URLRequest('http://www.uhrenlounge.de/shop/html/ajax_' + page + '.asp?x=1')
	}
}

function loadProductAsAdmin(Product_id,Product_name,p_hersteller_name,p_hersteller_id,p_serien_name,p_serien_id,e){
	e.href='javascript:void(0)';
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_addproduct.asp?Product_id=' + Product_id)
}

function checkallproducts(e,id){
	e.href='javascript:void(0)';
	elCount=document.getElementById('models_block_middle_'+id).getElementsByTagName('input').length
	pid=""
	for (i=0; i<elCount;i++){
		pv=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].id
		py=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].type
		pc=document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked
		if ((py=="checkbox")) {
			if (pc==false){
				document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked=true
			}else{
				document.getElementById('models_block_middle_'+id).getElementsByTagName('input')[i].checked=false
			}
		}
	}
}

function loadSelected(e){
	e.href='javascript:void(0)';
	elCount=document.getElementById('display_area_content').getElementsByTagName('input').length
	pid=""
	for (i=0; i<elCount;i++){
		pv=document.getElementById('display_area_content').getElementsByTagName('input')[i].id
		py=document.getElementById('display_area_content').getElementsByTagName('input')[i].type
		pc=document.getElementById('display_area_content').getElementsByTagName('input')[i].checked
		if ((py=="checkbox") && (pc==true)) {
			tmp=document.getElementById(pv).value
				if (tmp.indexOf("PID_")!=-1) pid+=tmp.replace("PID_","") + ","
			}
		}
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_admin_addproduct.asp?selected='+pid)
}

function loadProduct(Product_id,Product_name,p_hersteller_name,p_hersteller_id,p_serien_name,p_serien_id,e){
	e.href='javascript:void(0)';
	Modell_id=Product_id
	Modell_name=Product_name
	fullPrice=null
	LastMoveElement=null
	TimeToFade = 100
	fade('display_area_content')	
	TimeToFade = 200
	
	if(typeof(hersteller_name)=="undefined") window.hersteller_name=p_hersteller_name
	if(typeof(p_hersteller_id)!="undefined") window.hersteller_id=p_hersteller_id
	if(typeof(serien_name)=="undefined") window.serien_name=p_serien_name
	if(typeof(p_serien_id)!="undefined") window.serien_id=p_serien_id
	
	addhistory ("Hersteller/" + hersteller_id + "/" + hersteller_name.replace("/","-") + "/Serie/" + serien_id + "/" + serien_name.replace("/","-") + "/Modell/" + Modell_id + "/" + Modell_name.replace("/","-") + ".html")
	smoothScroll('serien_menu_container_right',1,0)
	URLRequest('http://www.uhrenlounge.de/shop/html/ajax_detail.asp?pid=' + Modell_id)
	document.getElementById('serien_menu_controls_filter').style.display="none"
	document.getElementById('serien_menu_controls').style.display="block"
	
}

function rgbConvert(str) {
   str = str.replace(/rgb\(|\)/g, "").split(",");
   str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
   str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
   str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
   str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
   str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
   str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
   return (str.join(""));
}

function FadeDIVin(elementID) {
	if ((elementID.Startcolor==undefined) || (elementID.Startcolor==null)) {
		elementID.Startcolor = getStyle(elementID, 'color')	
		if (elementID.Startcolor.indexOf("#")==-1) {
			elementID.Startcolor=rgbConvert(getStyle(elementID, 'color'))
		}else{
			elementID.Startcolor=elementID.Startcolor.replace("#","")
		}
	}
	
	//alert("FadeDIVin:" + elementID.Startcolor)
	if (FadeToBlack) clearTimeout(FadeToBlack)
    //if (animateColorTimeout) clearTimeout(animateColorTimeout)
	switch (elementID.Startcolor){
		case '888888':
			elementID.style.color="#000000"
			FadeToBlack=null
			break;
		case '4a4a4a':
			elementID.style.color="#ffffff"
			FadeToBlack=setTimeout("colorFade('" + elementID.id + "','color','ffffff','000000',40);",100)		
			break;
		case '000000':
			elementID.style.color="#aaaaaa"
			FadeToBlack=setTimeout("colorFade('" + elementID.id + "','color','aaaaaa','000000',10);",100)		
			break;
	}
}

function FadeDIVout(elementID) {
	//alert("FadeDIVout:" + elementID.Startcolor)
	if (FadeToBlack) clearTimeout(FadeToBlack)
	//elementID.style.color="#000000"
	//colorFade(elementID.id,'color','000000',elementID.Startcolor,2);
	if (animateColorTimeout) clearTimeout(animateColorTimeout)
	elementID.style.color="#" + elementID.Startcolor
}

function FadeDIVin2(elementID) {
	colorFade(elementID.id,'transparency','0.7','1',3); 	
}

function FadeDIVout2(elementID) {
	colorFade(elementID.id,'transparency','1','0.7',10);
}

// main function to process the fade request //
function colorFade(id,element,start,end,steps) {
  var startrgb,endrgb,er,eg,eb,step,rint,gint,bint,step;
  var target = document.getElementById(id);
  //clearInterval(target.timer);
  if (element=="color"){
	  endrgb = colorConv(end);
	  er = endrgb[0];
	  eg = endrgb[1];
	  eb = endrgb[2];
	  startrgb = colorConv(start);
      r = startrgb[0];
      g = startrgb[1];
      b = startrgb[2];
      target.r = r;
      target.g = g;
      target.b = b;
      rint = Math.round(Math.abs(target.r-er)/steps);
  	  gint = Math.round(Math.abs(target.g-eg)/steps);
  	  bint = Math.round(Math.abs(target.b-eb)/steps);
  	  if(rint == 0) { rint = 1 }
      if(gint == 0) { gint = 1 }
      if(bint == 0) { bint = 1 }
  }
  if (element=="transparency"){
  	  start=target.style.opacity
  	  target.v=start;
      target.t=Math.round((end-start)/steps*100)/100
	  target.style.filter = 'alpha(opacity = ' + (start*100) + ')';  
  }
  target.step = 1;
  animateColor(id,element,steps,er,eg,eb,rint,gint,bint,start,end)
  
}

// incrementally close the gap between the two colors //
function animateColor(id,element,steps,er,eg,eb,rint,gint,bint,start,end) {
  var target = document.getElementById(id);
  var color;
  if(target.step <= steps) {
	if (element=="color"){
      	var r = target.r;
    	var g = target.g;
    	var b = target.b;
	    if(r >= er) {
	      r = r - rint;
	    } else {
	      r = parseInt(r) + parseInt(rint);
	    }
	    if(g >= eg) {
	      g = g - gint;
	    } else {
	      g = parseInt(g) + parseInt(gint);
	    }
	    if(b >= eb) {
	      b = b - bint;
	    } else {
	      b = parseInt(b) + parseInt(bint);
	    }
	    color = 'rgb(' + r + ',' + g + ',' + b + ')';
	    target.style.color = color;
	    target.r = r;
	    target.g = g;
	    target.b = b;
	}
	if (element=="transparency"){
	  target.v=(target.v*100+target.t*100)/100
	  target.style.opacity = target.v
	  target.style.filter = 'alpha(opacity = ' + (target.v*100) + ')';  	
  	}	
    target.step = target.step + 1;
    animateColorTimeout=setTimeout( function() { animateColor(id,element,steps,er,eg,eb,rint,gint,bint,start,end) }, 10);
  }else{
	if (element=="transparency"){
	  target.style.opacity = end
	  target.style.filter = 'alpha(opacity = ' + (end*100) + ')';  	
  	}	  
  }
}

// convert the color to rgb from hex //

function colorConv(color) {
  var rgb = [parseInt(color.substring(0,2),16), 
    parseInt(color.substring(2,4),16), 
    parseInt(color.substring(4,6),16)];
  return rgb;
}

function fade(eid)
{
  var element = document.getElementById(eid);
  if(element == null)
    return;
    
  if(element.FadeState == null)
  {
    if(element.style.opacity == null
        || element.style.opacity == ''
        || element.style.opacity == '1')
    {
      element.FadeState = 2;
    }
    else
    {
      element.FadeState = -2;
    }
  }
  if(element.FadeState == 1 || element.FadeState == -1)
  {
    element.FadeState = element.FadeState == 1 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;
  }
  else
  {
    element.FadeState = element.FadeState == 2 ? -1 : 1;
    element.FadeTimeLeft = TimeToFade;
  }
   if (checkBrowserName()>=9) {
   		element.FadeRun=1
    	setTimeout("animateFade(" + new Date().getTime() + ",'" + eid + "')", 33);
   }else{
   		if (element.FadeState==1) {
   			element.style.visibility="visible"
   			element.style.opacity="1"
   			//element.style.filter = 'alpha(opacity = 100)';
   			//element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)';
   		}else{
   			element.style.visibility="hidden"
   			element.style.opacity="0"
   		}
	}
}

function animateFade(lastTick, eid)
{  
  var curTick = new Date().getTime();
  var elapsedTicks = curTick - lastTick;
 
  var element = document.getElementById(eid);
  if(element.FadeTimeLeft <= elapsedTicks)
  {
    element.style.opacity = element.FadeState == 1 ? '1' : '0';
    if (checkBrowserName()>=9) {
    	//element.style.filter = 'alpha(opacity = ' + (element.FadeState == 1 ? '100' : '0') + ')';
    	//element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + (element.FadeState == 1 ? '100' : '0') + ')';
    }else{
	    element.style.visibility = (element.FadeState == 1 ? 'visible' : 'hidden');
	}
    element.FadeState = element.FadeState == 1 ? 2 : -2;
    element.FadeRun=0
    return;
  }
 
  element.FadeTimeLeft -= elapsedTicks;
  var newOpVal = element.FadeTimeLeft/TimeToFade;
  if(element.FadeState == 1)
    newOpVal = 1 - newOpVal;

  element.style.opacity = newOpVal;
  if (checkBrowserName()>=9) {
  	//element.style.filter = 'alpha(opacity = ' + (newOpVal*100) + ')';
  	//element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity=' + (newOpVal*100) + ')';
  }else{
	element.style.visibility = 'hidden';
  }
  setTimeout("animateFade(" + curTick + ",'" + eid + "')", 33);
}

function currentYPosition() {
	if (self.pageYOffset)
		 return self.pageYOffset;
	if (document.documentElement && document.documentElement.scrollTop)
		return document.documentElement.scrollTop;
	if (document.body.scrollTop)
		 return document.body.scrollTop;
	return 0;
}
function elmYPosition(eID) {
	var elm  = document.getElementById(eID);
	var y    = elm.offsetTop;
	var node = elm;
	while (node.offsetParent && node.offsetParent != document.body) {
		node = node.offsetParent;
		y   += node.offsetTop;
	} return y;
}
function smoothScroll(eID,scrollbothdirections,offset) {
	var startY   = currentYPosition();
	var stopY    = elmYPosition(eID)+offset;
	var distance = stopY > startY ? stopY - startY : startY - stopY;
	if (!(scrollbothdirections) && (startY-stopY < 0)) {
		return;
	}
	if ((distance < 20) && (startY-stopY < 0)) {
		//scrollTo(0, stopY);
		return;
	}
	var speed = Math.round(distance / 100);
	var step  = Math.round(distance / 4);
	var leapY = stopY > startY ? startY + step : startY - step;
	var timer = 0;
	if (stopY > startY) {
		for ( var i=startY; i<stopY; i+=step ) {
			setTimeout("window.scrollTo(0, "+leapY+")", timer * speed);
			leapY += step; if (leapY > stopY) leapY = stopY; timer++;
		} return;
	}
	for ( var i=startY; i>stopY; i-=step ) {
		setTimeout("window.scrollTo(0, "+leapY+")", timer * speed);
		leapY -= step; if (leapY < stopY) leapY = stopY; timer++;
	}
}

