/* Allgemeine Funktionen
   Cobolt NetServices (www.cobolt.net)
   Author: [rob]
   Juni 2002
*/

/*
   DynAPI Distribution
   Browser Class

   The DynAPI Distribution is distributed under the terms of the GNU LGPL license.
*/
//-------------------{ browser & os detection }-----------------

function Browser() {
        var b=navigator.appName;
        if (b=="Netscape") this.b="ns";
        else if (navigator.userAgent.indexOf("Opera")>0) this.b = "opera";
        else if (b=="Microsoft Internet Explorer") this.b="ie";
        else if (navigator.userAgent.indexOf("Konqueror")>0) this.b = "konqueror"; // added
        if (!b) alert('Unidentified browser./nThis browser is not supported,');
        this.version=navigator.appVersion;
        this.v=parseInt(this.version);
        this.ns=(this.b=="ns" && this.v>=4);
        this.ns4=(this.b=="ns" && this.v==4);
        this.ns5=(this.b=="ns" && this.v==5);
        this.ie=(this.b=="ie" && this.v>=4);
        this.ie4=(this.version.indexOf('MSIE 4')>0);
        this.ie5=(this.version.indexOf('MSIE 5')>0);
				this.ie516=(this.version.indexOf('MSIE 5.1')>0); // added
        this.ie55=(this.version.indexOf('MSIE 5.5')>0);
        this.ie6=(this.version.indexOf('MSIE 6')>0); // added
        this.opera=(this.b=="opera");
        this.kon=(this.b=="konqueror"); // added
        this.dom=document.getElementById?1:0
        var ua=navigator.userAgent.toLowerCase();
        if (ua.indexOf("win")>-1) this.platform="win32";
        else if (ua.indexOf("mac")>-1) this.platform="mac";
        else this.platform="other";
}
is = new Browser();

//----------------------{ preload images }-----------------------

function preload(imgObj,imgSrc){
        eval(imgObj + ' = new Image()');
        eval(imgObj + '.src = "' + imgSrc + '"');
}

//------------------------{ change img }-------------------------

var aktiv = false;
var currentPic,randomPlace;

function swap(imgObj,imgName){
        if(is.ie5 || is.ie55 || is.ie6) document.images[imgName].filters.blendTrans.Apply();
        document.images[imgName].src = eval(imgObj+'.src');
        if(is.ie5 || is.ie55 || is.ie6) document.images[imgName].filters.blendTrans.Play();
}

function init(picList){

    if(aktiv) window.clearIntervall(aktiv);
    aktiv = window.setInterval('getOffer(\"'+picList+'\")',6000);
}

function getOffer(picList){

    randomPlace = Math.round(Math.random());
    myItems = picList.split(",");
    myItemsAnz = myItems.length;
    randomPic = Math.abs(Math.round(Math.random()*(myItemsAnz))-1);
    swap('pic'+ myItems[randomPic] +'','promo'+ randomPlace +'');
}

//--------------------{ status display }-----------------------

var defaulttext='Produced and hosted by Cobolt NetServices (www.cobolt.net)';
window.status = defaulttext;

function showstatus(text){
          if(text!='default'){
                  window.status=text;
                  return true;
                  alert('')
          }else {
                  window.status = defaulttext;
                  return true;
          }
}

//------------------------{ print }----------------------------

function drucken(){
        alert('Vergewissern Sie sich bitte,\ndass die Seite im Querformat gedruckt wird.')
        window.print()
}

//---------------------{ window open }-------------------------

function wopen(url,attr){
        win = window.open('../main/popup.html?'+url+'','pop',attr);
        win.moveTo(100,100);
        win.focus();
}

//----------------------{ open pdf }---------------------------

function openPDF(url){
        if(is.ie){
                winPDF = window.open(url,'popPDF');
                winPDF.focus();
        } else location.href = url;
}


function submitForm() {
	if (document.searchform.ort.value != '') {
		document.searchform.search.value=document.searchform.ort.value;
		}
	if (document.searchform.plz.value != '') {
		document.searchform.search.value=document.searchform.plz.value;
		}
	document.searchform.submit();
	}
	

function setFocus(inp) {
	if (inp == 1) {
		document.searchform.ort.value='';
		}
	if (inp == 2) {
		document.searchform.plz.value='';
		}
	}
	
