function evalScript(scripts)
{	try
	{	if(scripts != '')	
		{	var script = "";
			scripts = scripts.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(){
	       	                         if (scripts !== null) script += arguments[1] + '\n';
 	        	                        return '';});
			if(script) (window.execScript) ? window.execScript(script) : window.setTimeout(script, 0);
		}
		return false;
	}
	catch(e)
	{	alert(e)
	}
}

/*
 * 
 * Array Foreach Schleife
 */
Array.prototype.foreach = function( callback ) {
	  for( var k=0; k<this .length; k++ ) {
	    callback( k, this[ k ] );
	  }
	} 

var requestsRegex =/(.jpg|.jpeg|.gif|.png|.bmp|.pgf|.bref|.doc|.docx|.txt|.dwg|.dxf|.dgn|.dxb|.dwf|.dtn|.eps|.epsf|.hdri|.ifc|.iges|.idf|.kml|.obj|.pdf|.plt|.step|.stl|.sat|.brephdri|.stp|.shape|.tif|.vrml|.3ds|.zip|.rar)$/i;
var imgRegex =/(.jpg|.jpeg|.gif|.png)$/i;


function check_Requets_upload(obj,style, message){ 
	
	result = requestsRegex.test(obj.value.toLowerCase());
	
	if(result == 0){
		
		document.getElementById('div_' + obj.name).innerHTML ='<input type="file" class="Input" id="' + obj.id + '" name="' + obj.name + '"  onchange="check_Requets_upload(this,\'' + style + '\',\'' + message + '\');"  style="' + style + '">';
		
		//alert("Die Datei muss ein jpg/jpeg-Bild sein");
		alert(message);
		document.getElementById(obj.name).focus();
		return false;
	}else
		return true;
}

function checkAjaxFileUpload(obj,style, message, fileIndex, SESSIONID){
	var result = requestsRegex.test(obj.value.toLowerCase());
	
	if(result == 0){
		
		document.getElementById('div_' + obj.name).innerHTML ='<input type="file" class="Input" id="' + obj.id + '" name="' + obj.name + '"  onchange="if(checkAjaxFileUpload(this,\'' + style + '\',\'' + message + '\')){ajaxFileUpload(this, ' + fileIndex + ', \'' + escape(style) + '\', \'' + SESSIONID + '\');}"  style="' + style + '">';
		
		//alert("Die Datei muss ein jpg/jpeg-Bild sein");
		alert(message);
		document.getElementById(obj.name).focus();
		return false;
	}else{
		
		return true;
	}
	
}

function ajaxFileUpload(fileElement, fileIndex, fileElementStyle, SESSIONID)
{
	jQuery.ajaxFileUpload
	(
		{
			url:'./inc/ajax/AjaxSuppliersearchFileUpload.inc.php?SESSIONID=' + SESSIONID + '&filename=' + fileElement.name + '&fileElementId=' + fileElement.id + '&fileIndex=' + fileIndex + '&fileElementStyle=' + fileElementStyle,
			secureuri:false,
			fileElementId:fileElement.id,
			dataType: 'json',
			data:{name:'logan', id:'id'},
			success: function (data, status)
			{
				if(typeof(data.error) != 'undefined')
				{
					if(data.error != '')
					{
						if(data.error == "BuyerProUpgrade"){
							
							document.getElementById("overlay_dim").style.display='inline';
							document.getElementById("ContentBuyerProUpgrade").style.display='inline';
						}
						else
							alert(data.error);
					}else if(data.msg != '')
					{
						alert(data.msg);
					}
					
					if(data.contentValue != '')
					{
						document.getElementById('div_' + fileElement.name).innerHTML = data.contentValue;
					}
				}
			},
			error: function (data, status, e)
			{
				alert(e);
			}
		}
	);

}


function ajaxDelFileUploaded(FileuploadId, fileElementname, fileIndex, FileuploadStyle, SESSIONID){
	http_request = getHttpRequest();
	//alert(FileuploadStyle);
    if (!http_request) {
        alert('Ajax Ende HttpRequest:( no-Instanz');
        return false;
    }
    
	http_request.onreadystatechange = function(){
		if (http_request.readyState == 4) {
		    if (http_request.status == 200) {
				if(http_request.responseText == 'false'){
					
				}else{
					//alert(http_request.responseText);
					document.getElementById('div_' + fileElementname).innerHTML = http_request.responseText;
				}
		    } else {
		        alert('problem.');
		    }
		}
	};
    http_request.open('POST', './inc/ajax/ajaxDelFileUploaded.inc.php',true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send('SESSIONID=' + SESSIONID + '&fileIndex=' + fileIndex + '&Fileuploadname=' + fileElementname + '&FileuploadId=' + FileuploadId + '&FileuploadStyle=' + FileuploadStyle);
}

function checkFile(file, settings){
	
	var str = "{";
	for (var i in settings) {
		if(str != "{") str +=", ";
		str += i + ":'" + settings[i] + "'";
		
	}
	str +="}";
	
	
	//var settings = eval("("+settingsstr+")");
	var cFile =  document.getElementById(settings.Content);
	var newFile = "<input name=\"" + file.name + "\" ";
	if(file.id) newFile += "id=\"" + file.id + "\" ";
	
	newFile += "type=\"file\" onchange=\"checkFile(this, " + str + ");\" ";
	
	if(settings.FileStyle) newFile += "style=\"" + settings.FileStyle + "\" ";
	if(settings.CssClass) newFile += "class=\"" + settings.CssClass + "\" ";
	
	newFile += "/>";
	
	var targetFrame = settings.targetFrame;
	
	if(checkFile.arguments.length > 2)
		result = checkFile.arguments[2].test(file.value.toLowerCase());
	else
		result = requestsRegex.test(file.value.toLowerCase());
	
	if(result == 0){
		cFile.innerHTML =newFile;
    	alert(settings.FileTypeMessage);
		document.getElementById(file.id).focus();
	}else{
		
		//var form = document.getElementById(settings.Form);
		var form = document.forms[settings.Form]; 
		form.action = settings.action;
		form.target = settings.targetFrame;
		form.submit();
		
		var ret="";
		jQuery(document).ready(function($){
			jQuery("#" + targetFrame).load(
		        function($) {
		        		
		        	if(settings != null){
		        		
			        	//ret = frames[settings.targetFrame].document.getElementsByTagName("div")[0].innerHTML;
			        	ret = frames[settings.targetFrame].document.getElementsByTagName("div")[0].innerHTML;
			        	if(ret != ""){
				        	var data = eval("("+ret+")"); //parse json
				        	
				        	if(typeof(data.error) != 'undefined')
							{
								if(data.error != '')
								{
									//alert(newFile);
									
					            	cFile.innerHTML =newFile;
								
									if(data.error == "BuyerProUpgrade"){
										
										document.getElementById("overlay_dim").style.display='inline';
										document.getElementById("ContentBuyerProUpgrade").style.display='inline';
									}
									else
										alert(data.error);
									
									
								}else if(data.msg != '')
								{
									alert(data.msg);
								}
							}
				        	
				        	form.action = settings.defaultaction;
				            form.target = settings.target;
				            
				        	frames[settings.targetFrame].document.getElementsByTagName("div")[0].innerHTML = "";
				        	settings = null;
			        	}
		        	}
		        }
		    );
		});
	}
}


function delOfferNewFile(sessionID, index, outputID, br) {
		
    http_request = getHttpRequest();
	idOutputID = outputID;
    if (!http_request) {
        alert('Ajax Ende HttpRequest:( no-Instanz');
        return false;
    }
    
    
	http_request.onreadystatechange = outputdelOfferNewFile;
    http_request.open('POST', './inc/ajax/delOfferNewFile.inc.php',true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send('SESSIONID=' + sessionID + '&delFile=' + index + '&br=' + br);
}

function outputdelOfferNewFile() {
	if (http_request.readyState == 4) {
	    if (http_request.status == 200) {
			if(http_request.responseText == 'false'){
				
			}else{
				document.getElementById(idOutputID).innerHTML = http_request.responseText;
			}
	    } else {
	        alert('problem.');
	    }
	}
}


//
//Parameter:
//	file: Video to play
//  width: Player width
//	height: Player height
//	donloadflvID: Link to donload Flash player
function StartVideo(file, width, height, donloadflvID){
	var so = new SWFObject('./flvplayer/flvplayer.swf','mpl',width,height,'7');
	so.addParam('allowfullscreen','true');
	so.addParam('allowscriptaccess','always');
	so.addParam('wmode','transparent');
	so.addVariable('file',file);
	so.addVariable('height',height);
	so.addVariable('width',width);
	so.write(donloadflvID);
} 

function validateEmail(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   
   if(reg.test(email) == false) {
      return false;
   }
   
   return true;
}
function getHttpRequest(){
	
	http_request = false;
	// url = url + "?value=" + document.testform.input.value;
	
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
            // zu dieser Zeile siehe weiter unten
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    return http_request;
    
}


function replaceCharacters(from, to, txt) {  
	
	var newString = txt.split(from);  
	newString = newString.join(to);  
	return newString;
}
function formatValue(obj) {
	
	var ns = obj.value;
	ns = replaceCharacters('.', '', ns);
	ns = replaceCharacters(',', '.', ns);
	
	var decimals  = 2;
	
	if(formatValue.arguments.length > 1)
		decimals = formatValue.arguments[1];
	//alert(decimals);
    if(ns.length > 0){
    	
    	obj.value = number_format(ns, decimals, ',', '.');
		/*
    	if(ns.indexOf (".") > -1)
    		obj.value = number_format(ns, decimals, ',', '.');
		else
			obj.value = number_format(ns, 0, null, ".");
		*/
    }

}
function number_format (number, decimals, dec_point, thousands_sep)
{
	  var exponent = "";
	  var numberstr = number.toString ();
	
	  var eindex = numberstr.indexOf ("e");
	  if (eindex > -1)
	  {
	    exponent = numberstr.substring (eindex);
	    number = parseFloat (numberstr.substring (0, eindex));
	  }
	  
	  if (decimals != null)
	  {
	    var temp = Math.pow (10, decimals);
	    number = Math.round (number * temp) / temp;
	  }
	  
	  var sign = number < 0 ? "-" : "";
	  var integer = (number > 0 ? 
	      Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
	  
	  var fractional = number.toString ().substring (integer.length + sign.length);
	  dec_point = dec_point != null ? dec_point : ".";
	  fractional = decimals != null && decimals > 0 || fractional.length > 1 ? 
	               (dec_point + fractional.substring (1)) : "";
	  if (decimals != null && decimals > 0)
	  {
	    for (i = fractional.length - 1, z = decimals; i < z; ++i)
	      fractional += "0";
	  }
	  
	  thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
	                  thousands_sep : null;
	  if (thousands_sep != null && thousands_sep != "")
	  {
		for (i = integer.length - 3; i > 0; i -= 3)
	      integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
	  }
	  
	  return sign + integer + fractional + exponent;
}

function ValidateNumberKeyPress(field, evt, decimals)
{
	if(decimals == null) decimals = true;
	
    var charCode = (evt.which) ? evt.which : event.keyCode
    var keychar = String.fromCharCode(charCode);

    if (charCode > 31 && (charCode < 48 || charCode > 57) && keychar != ","  && keychar != "-" )
    {
        return false;
    }

    if (keychar == "," && (!decimals || field.value.indexOf(",") != -1)) 
    {
        return false;
    }
        
    if(keychar == "-")
    {
        if (field.value.indexOf("-") != -1 /* || field.value[0] == "-" */) 
        {
            return false;
        }
        else
        {
            //save caret position
            var caretPos = getCaretPosition(field);
            if(caretPos != 0)
            {
                return false;
            }
        }
    }

    return true;
}

function ValidateNumberKeyUp(field, decimals)
{
	if (window.getSelection){
		if(window.getSelection().type == "Text")
	    {
	        return;
	    }
	}
	else if (document.getSelection) { 
		if(document.getSelection().type == "Text")
	    {
	        return;
	    }
	}else if(document.selection){
		if(document.selection.type == "Text")
	    {
	        return;
	    }
	}
	if(decimals == null) decimals = true;
     //save caret position
    var caretPos = getCaretPosition(field);
    
    var fdlen = field.value.length;
    
    UnFormatNumber(field);
    
    var IsFound = /^-?\d+\,{0,1}\d*$/.test(field.value);
    if(!IsFound)
    {
        setSelectionRange(field, caretPos, caretPos);
        return false;             
    }
    
    field.value = FormatNumber(field.value, decimals);
    
    fdlen = field.value.length - fdlen;

    
    setSelectionRange(field, caretPos+fdlen, caretPos+fdlen);
}

function ValidateAndFormatNumber(NumberTextBox)
{
    if(NumberTextBox.value == "") return;
    
    UnFormatNumber(NumberTextBox);

    var IsFound = /^-?\d+\,{0,1}\d*$/.test(NumberTextBox.value);
    if(!IsFound)
    {
        alert("Not a number");
        NumberTextBox.focus();
        NumberTextBox.select();  
        return;             
    }
    
    if(isNaN(parseFloat(NumberTextBox.value)))
    {
        alert("Number exceeding float range");
        NumberTextBox.focus();
        NumberTextBox.select();               
    }

    NumberTextBox.value = FormatNumber(NumberTextBox.value);
}

function FormatNumber(fnum, decimals)
{
	if(decimals == null) decimals = true;
    var orgfnum = fnum;
    var flagneg = false;
    
    if(fnum.charAt(0) == "-")
    {
        flagneg = true;
        fnum = fnum.substr(1, fnum.length-1);
    }
    
    psplit = fnum.split(",");
    
    var cnum = psplit[0],
        parr = [],
        j = cnum.length,
        m = Math.floor(j / 3),
        n = cnum.length % 3 || 3;

    // break the number into chunks of 3 digits; first chunk may be less than 3
    for (var i = 0; i < j; i += n) {
        if (i != 0) {n = 3;}
        parr[parr.length] = cnum.substr(i, n);
        m -= 1;
    }

    // put chunks back together, separated by point
    fnum = parr.join(".");

    if(decimals){
	    // add the precision back in
	    //if (psplit[1]) {fnum += "," + psplit[1];}
	    if (orgfnum.indexOf(",") != -1)  
	    {
	        fnum += "," + psplit[1];
	    }
    }
    
    if(flagneg == true)
    {
        fnum = "-" + fnum;
    }
    
    return fnum;
}
   
function UnFormatNumber(obj)
{
    if(obj.value == "") return;
    obj.value = replaceCharacters('.', '', obj.value);
}

function getCaretPosition(objTextBox){

    var objTextBox = window.event.srcElement;

    var i = objTextBox.value.length;

    if (objTextBox.createTextRange){
        objCaret = document.selection.createRange().duplicate();
        while (objCaret.parentElement()==objTextBox &&
          objCaret.move("character",1)==1) --i;
    }
    return i;
}

function setSelectionRange(input, selectionStart, selectionEnd) {
    if (input.setSelectionRange) {
        input.focus();
        input.setSelectionRange(selectionStart, selectionEnd);
    }
    else if (input.createTextRange) {
        var range = input.createTextRange();
        range.collapse(true);
        range.moveEnd('character', selectionEnd);
        range.moveStart('character', selectionStart);
        range.select();
    }
}

//
//Remove an element from array
//Parameter: Array and element to remove
function removeByElement(arrayName,arrayElement)
{
   for(var i=0; i<arrayName.length;i++ )
    { 
       if(arrayName[i]==arrayElement)
           arrayName.splice(i,1); 
     } 
}

function getCode(s) {
	  
	  if (s.length>0) {
	    var i,j;
	    var s2=escape(s);
	    //Zeilenumbrueche verkuerzen
	    var a1=s2.split("%0D");
	    s2="";
	    for (i=0;i<a1.length;i++) {
	      s=a1[i];
	      if (s.substring(0,3)=="%0A") { s=s.substring(3,s.length); }
	      s2+="%0D"+s;
	    }
	    s2=s2.substring(3,s2.length);
	    //Leerzeichen ohne Code
	    var a2=s2.split("%20");
	    s2="";
	    for (i=0;i<a2.length;i++) { s=a2[i]; s2+=" "+s;}
	    s2=s2.substring(1,s2.length);
	    return s2
	  }
	  
	  return s;
	}

function urlencode (str) {
	str = (str+'').toString();
    // Tilde should be allowed unescaped in future versions of PHP (as reflected below), but if you want to reflect current
	// PHP behavior, you would need to add ".replace(/~/g, '%7E');" to the following.
	return encodeURIComponent(str).replace(/!/g, '%21').replace(/'/g, '%27').replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/\*/g, '%2A').replace(/%20/g, '+');
}

String.prototype.trim = function() {

	 // skip leading and trailing whitespace
	 // and return everything in between
	  var x=this;
	  x=x.replace(/^\s*(.*)/, "$1");
	  x=x.replace(/(.*?)\s*$/, "$1");
	  return x;
	}

String.prototype.escape = function(){
	var x=this;
	//x = escape(x);
	//alert(x);
	//var arrRep = new Array("%E4", "%C4", "%F6", "%D6", "%FC", "%DC", "%DF");
	//var arr = new Array("%C3%A4", "%C3%84", "%C3%B6", "%C3%96", "%C3%BC", "%C3%9C", "%C3%9F");
	
	/*x=x.replace("ä", "%E4");
	x=x.replace("Ä", "%C4");
	x=x.replace("ö", "%F6");
	x=x.replace("Ö", "%D6");
	x=x.replace("ü", "%FC");
	x=x.replace("Ü", "%DC");
	x=x.replace("ß", "%DF");
	*/
	/*
	for(var i=0; i<arr.length; i++){
		x=x.replace(arr[i], arrRep[i]);
	}
	*/
	
	var arr = new Array("ä", "Ä", "ö", "Ö", "ü", "Ü", "ß");
	var arrRep = new Array("%E4", "%C4", "%F6", "%D6", "%FC", "%DC", "%DF");
	
	for(var i=0; i<arr.length; i++){
		x=x.replace(arr[i], arrRep[i]);
	}
	return x;
}

MaskInput = function(f, m){ //v1.0
    function mask(e){
        var patterns = {"1": /[A-Z]/i, "2": /[0-9]/, "4": /[À-ÿ]/i, "8": /./ },
            rules = { "a": 3, "A": 7, "9": 2, "C":5, "c": 1, "*": 8};
        function accept(c, rule){
            for(var i = 1, r = rules[rule] || 0; i <= r; i<<=1)
                if(r & i && patterns[i].test(c))
                    break;
                return i <= r || c == rule;
        }
        var k, mC, r, c = String.fromCharCode(k = e.key), l = f.value.length;
        (!k || k == 8 ? 1 : (r = /^(.)\^(.*)$/.exec(m)) && (r[0] = r[2].indexOf(c) + 1) + 1 ?
            r[1] == "O" ? r[0] : r[1] == "E" ? !r[0] : accept(c, r[1]) || r[0]
            : (l = (f.value += m.substr(l, (r = /[A|9|C|\*]/i.exec(m.substr(l))) ?
            r.index : l)).length) < m.length && accept(c, m.charAt(l))) || e.preventDefault();
    }
    for(var i in !/^(.)\^(.*)$/.test(m) && (f.maxLength = m.length), {keypress: 0, keyup: 1})
        addEvent(f, i, mask);
};

addEvent = function(o, e, f, s){
    var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
    r[r.length] = [f, s || o], o[e] = function(e){
        try{
            (e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
            e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
            e.target || (e.target = e.srcElement || null);
            e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
        }catch(f){}
        for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
        return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
    for(var i = (e = o["_on" + e] || []).length; i;)
        if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
            return delete e[i];
    return false;
};

function floatCenterObj(id){
	var objTop = document.getElementById(id).style.top;
	var objwidth = document.getElementById(id).style.width;

	objTop = objTop.substring(0, objTop.length - 2);
	objwidth = parseInt(objwidth.substring(0, objwidth.length - 2));
	var objWinl = parseInt((window.document.body.clientWidth - objwidth)/2);

	document.getElementById(id).style.left = objWinl + 'px';
	
	JSFX_FloatDiv(id, objWinl,parseInt(objTop)).floatIt();
}

function CenterObj(id){
	var objwidth = document.getElementById(id).style.width;
	objwidth = parseInt(objwidth.substring(0, objwidth.length - 2));
	var objWinl = parseInt((window.document.body.clientWidth - objwidth)/2);
	
	var clientWidth = parseInt(window.document.body.clientWidth);
	
	if(clientWidth >= objwidth){
		var d = document;
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		var px = document.layers ? "" : "px";
		window[id + "_obj"] = el;
		if(d.layers)el.style=el;
		el.cx = el.sx = objWinl;
		//el.cy = el.sy = sy;
		el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};
	}
}
//MaskInput(f.fone, "(99)9999-9999"); Phone number
//MaskInput(f.date, "99/99/9999");//Date
//MaskInput(f.etc, "Cc99-*C");
//MaskInput(f.except, "E^abc");
//MaskInput(f.only, "O^abc");
//MaskInput(f.letra, "C^");
//MaskInput(f.letra2, "C^ ");
//MaskInput(f.numero, "9^abc");



//
//Datepicker an Objekt zuordnen
//Die Js Dateien:
//      jquery/jquery-1.4.4.js, jquery/ui/jquery.ui.core.js, jquery/ui/jquery.ui.widget.js, jquery/ui/jquery.effects.core.js, jquery/ui/jquery.effects.clip.js,
//	    jquery/ui/jquery.ui.datepicker.js
//müssen forher in index.php inkludiert werden

jQuery.noConflict();

function setDatepicker(obj, title){
	zIndex = 2000;
	if(setDatepicker.arguments.length > 2)
		zIndex = setDatepicker.arguments[2];
	
	//jQuery.noConflict();

	jQuery(document).ready(function($){
		jQuery(obj).datepicker({
			//showButtonPanel: true,
		    changeMonth: true,
			changeYear: true,
			showOn: "button",
			buttonImage: "./images/icons/calendar.gif",
			buttonImageOnly: true,
			buttonText: title,
			beforeShow: function() {setTimeout(function()

			           {

							jQuery(".ui-datepicker").css("z-index", zIndex);

			           }, 10); 

				  },
			dateFormat:"dd.mm.yy",
			showAnim:"clip"
		});
		jQuery(".ui-datepicker-trigger").mouseover(function() { jQuery(this).css('cursor', 'pointer');}); 
	});

	
}

var TINY={};

function T$(i){return document.getElementById(i)}
function T$$(e,p){return p.getElementsByTagName(e)}

TINY.accordion=function(){
	function slider(n){this.n=n; this.a=[]}
	slider.prototype.init=function(t,e,m,o,k){
		
		var a=T$(t), i=s=0, n=a.childNodes, l=n.length; this.s=k||0; this.m=m||0;
		for(i;i<l;i++){
			var v=n[i];
			
			if(v.nodeType!=3){
				this.a[s]={}; this.a[s].h=h=T$$(e,v)[0]; this.a[s].c=c=T$$('div',v)[0]; h.onclick=new Function(this.n+'.pr(0,'+s+')');
				if(o==s){h.className=this.s; c.style.height='auto'; c.d=1}else{c.style.height=0; c.d=-1} s++
			}
		}
		this.l=s
	};
	slider.prototype.pr=function(f,d){
		for(var i=0;i<this.l;i++){
			var h=this.a[i].h, c=this.a[i].c, k=c.style.height; k=k=='auto'?1:parseInt(k); clearInterval(c.t);
			if((k!=1&&c.d==-1)&&(f==1||i==d)){
				c.style.height=''; c.m=c.offsetHeight; c.style.height=k+'px'; c.d=1; h.className=this.s; su(c,1)
			}else if(k>0&&(f==-1||this.m||i==d)){
				c.d=-1; h.className=''; su(c,-1)
			}
		}
	};
	function su(c){c.t=setInterval(function(){sl(c)},1)};
	function sl(c){
		var h=c.offsetHeight, d=c.d==1?c.m-h:h; c.style.height=h+(Math.ceil(d/5)*c.d)+'px';
		c.style.opacity=h/c.m; c.style.filter='alpha(opacity='+h*100/c.m+')';
		if((c.d==1&&h>=c.m)||(c.d!=1&&h==1)){if(c.d==1){c.style.height='auto'} clearInterval(c.t)}
	};
	return{slider:slider}
	
}();

/*
 * Popup Dialog intialisieren
 */
function InitModal(modalContentId, modalTitleId, modaldataId, overlayId, overlayClass, position, overlayClose){
	var OSX = {
			container: null,
			init: function () {
				
				jQuery("#" + modalContentId).modal({
					overlayId: overlayId,
					overlayClass:overlayClass,
					containerId: 'modal-container',
					closeHTML: null,
					minHeight: 80,
					opacity: 65, 
					position: position,
					overlayClose: overlayClose,
					onOpen: OSX.open,
					onClose: OSX.close
				});
			},
			open: function (d) {
				var self = this;
				self.container = d.container[0];
				d.overlay.fadeIn('slow', function () {
					jQuery("#" + modalContentId, self.container).show();
					var title = jQuery("#" + modalTitleId, self.container);
					title.show();
					d.container.slideDown('slow', function () {
						setTimeout(function () {
							var h = jQuery("#" + modaldataId, self.container).height()
								+ title.height()
								+ 20; // padding
							d.container.animate(
								{height: h}, 
								200,
								function () {
									jQuery("div.close", self.container).show();
									jQuery("#" + modaldataId, self.container).show();
								}
							);
						}, 300);
					});
				})
			},
			close: function (d) {
				var self = this; // this = SimpleModal object
				d.container.animate(
					{top:"-" + (d.container.height() + 20)},
					500,
					function () {
						self.close(); // or $.modal.close();
					}
				);
			}
		};

		OSX.init();
}


function Size( width, height ) {
	this.size={
			width:width,
			height:height
			
	};
	
	return this.size;
}

function getBrowserSize() {
	  var myWidth = 0, myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }
	  
	  return new Size(myWidth, myHeight);
}

/*
 * 
 * styled Combobox
 */
jQuery(document).ready(function(){
	try {
		oHandler = jQuery(".styledSelbox").msDropDown({mainCSS:'styledSelbox'});
		
	} catch(e) {
		alert("Error: "+e.message);
	}
});

function SetMaxHeight(cssName){
	var max_height = 0;
	jQuery('.' + cssName).each(function(e) {
	  h = jQuery(this).height();
	  if(typeof(h) != "undefined") {
	        if(h > max_height) {
	                max_height = h;
	        }
	  }
	});
	if(max_height > 0) {
	 jQuery('.' + cssName).height(max_height);
	}
}


