function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function confirmDelete() {
  check = confirm("Wollen Sie die ausgewählten Veranstaltungen wirklich löschen?");
  if(check == true) {
    document.vaformular.template.value = 'd_ulm_pro_delete';
	  document.vaformular.action = '/sixcms/detail.php';
	  document.vaformular.method = 'post';
	  document.vaformular.submit();
  } else {
    return false;
  }
}

function confirmDeleteArticle(art_id) {
  check = confirm("Wollen Sie das ausgewählte Inserat wirklich löschen?");
  if(check == true) {
    location.href = '/leben_in_ulm/buergerengagement_vereine/inserat_loeschen.20068.3076,3665,3708,4177,20067,20068.htm?_article_id=' + art_id;
  } else {
    return false;
  }
}

function confirmSubmit() {
  check = confirm("Sind Ihre Angaben vollständig? Eine Bearbeitung nach dem Absenden ist nicht mehr möglich. Wollen Sie Ihre Angaben jetzt übermitteln?");
  if(check == true)
	  document.eintragungsformular.submit();
  else
    return false;
}

function sendForm(modus, va_id) {

  if(modus == 'save') {
    document.vaformular.template.value = 'd_ulm_pro_save';
  	document.vaformular.action = '/sixcms/detail.php';
  	document.vaformular.method = 'post';
  	document.vaformular.submit();
  }
  else if(modus == 'edit') {
    document.vaformular._article_id.value = va_id;
    document.vaformular.template.value = 'd_ulm_pro_edit';
  	document.vaformular.action = '/sixcms/detail.php';
  	document.vaformular.method = 'post';
  	document.vaformular.submit();
  }
  else if(modus == 'search') {
    document.vasuchformular.template.value = 'd_ulm_pro_verliste';
  	document.vasuchformular.action = '/sixcms/detail.php';
  	document.vasuchformular.method = 'get';
  	document.vasuchformular.submit();
  }
}

/* Zurücksetzen-Funktion im Telefon-Verzeichnis */
function custom_reset() {
  document._verzeichnis.fb.selectedIndex = 0;
  document._verzeichnis.abt.selectedIndex = 0;
  document._verzeichnis.vt_frei.value = "";
}

function check_values() {

  var f1 = "name";
  var f2 = "email";
  var str_name = document.forms['tvform']['input['+f1+']'].value;
  var str_email = document.forms['tvform']['input['+f2+']'].value;

  if(str_name == "" && (str_email == "" || check_email(str_email) == false)) {
    alert("Bitte füllen Sie die Felder 'Name' und 'E-Mail' korrekt aus!");
    return false;
  }
  else if(str_name == "") {
    alert("Bitte füllen Sie das Feld 'Name' aus!");
    return false;
  }
  else if(str_email == "" || check_email(str_email) == false) {
    alert("Bitte füllen Sie das Feld 'E-Mail' korrekt aus!");
    return false;
  }
  else {
    document.tvform.submit();
    return true;
  }

}

function check_email(s) {

  var a = false;
  var res = false;

  if(typeof(RegExp) == 'function') {

    var b = new RegExp('abc');
    if(b.test('abc') == true)
      a = true;
  }

  if(a == true) {

    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)' + '(\\@)([a-zA-Z0-9\\-\\.]+)' + '(\\.)([a-zA-Z]{2,4})$');
    res = (reg.test(s));

  } else {

    res = (s.search('@') >= 1 && s.lastIndexOf('.') > s.search('@') &&  s.lastIndexOf('.') >= s.length-5);
  }

  return(res);
}


/*
 * FlashObject embed
 * http://blog.deconcept.com/2004/10/14/web-standards-compliant-javascript-flash-detect-and-embed/
 *
 * by Geoff Stearns (geoff@deconcept.com, http://www.deconcept.com/)
 *
 * v1.0.7 - 11-17-2004
 *
 * Create and write a flash movie to the page, includes detection
 *
 * Usage:
 *
 *	myFlash = new FlashObject("path/to/swf.swf", "swfid", "width", "height", flashversion, "backgroundcolor");
 *	myFlash.altTxt = "Upgrade your Flash Player!";                // optional
 *	myFlash.addParam("wmode", "transparent");                     // optional
 *	myFlash.addVariable("varname1", "varvalue");                  // optional
 *	myFlash.addVariable("varname2", getQueryParamValue("myvar")); // optional
 *	myFlash.write();
 *
 */

FlashObject = function(swf, id, w, h, ver, c, alt) {
	this.swf = swf;
	this.id = id;
	this.width = w;
	this.height = h;
	this.version = ver || 6; // default to 6
	this.align = "middle"; // default to middle
	this.redirect = "";
	this.sq = document.location.search.split("?")[1] || "";
	this.altTxt = alt;
	//this.bypassTxt = "<p>Already have Flash Player? <a href='?detectflash=false&"+ this.sq +"'>Click here if you have Flash Player "+ this.version +" installed</a>.</p>";
	this.bypassTxt = "";
	this.params = new Object();
	this.variables = new Object();
	if (c) this.color = this.addParam('bgcolor', c);
	this.addParam('quality', 'high'); // default to high
	this.doDetect = getQueryParamValue('detectflash');
}

FlashObject.prototype.addParam = function(name, value) {
	this.params[name] = value;
}

FlashObject.prototype.getParams = function() {
    return this.params;
}

FlashObject.prototype.getParam = function(name) {
    return this.params[name];
}

FlashObject.prototype.addVariable = function(name, value) {
	this.variables[name] = value;
}

FlashObject.prototype.getVariable = function(name) {
    return this.variables[name];
}

FlashObject.prototype.getVariables = function() {
    return this.variables;
}

FlashObject.prototype.getParamTags = function() {
    var paramTags = "";
    for (var param in this.getParams()) {
        paramTags += '<param name="' + param + '" value="' + this.getParam(param) + '" />';
    }
    if (paramTags == "") {
        paramTags = null;
    }
    return paramTags;
}

FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (window.ActiveXObject && navigator.userAgent.indexOf('Mac') == -1) { // PC IE
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '">';
        flashHTML += '<param name="movie" value="' + this.swf + '" />';
        if (this.getParamTags() != null) {
            flashHTML += this.getParamTags();
        }
        if (this.getVariablePairs() != null) {
            flashHTML += '<param name="flashVars" value="' + this.getVariablePairs() + '" />';
        }
        flashHTML += '</object>';
    }
    else { // Everyone else
        flashHTML += '<embed type="application/x-shockwave-flash" src="' + this.swf + '" width="' + this.width + '" height="' + this.height + '" id="' + this.id + '" align="' + this.align + '"';
        for (var param in this.getParams()) {
            flashHTML += ' ' + param + '="' + this.getParam(param) + '"';
        }
        if (this.getVariablePairs() != null) {
            flashHTML += ' flashVars="' + this.getVariablePairs() + '"';
        }
        flashHTML += '></embed>';
    }
    return flashHTML;
}


FlashObject.prototype.getVariablePairs = function() {
    var variablePairs = new Array();
    for (var name in this.getVariables()) {
        variablePairs.push(name + "=" + escape(this.getVariable(name)));
    }
    if (variablePairs.length > 0) {
        return variablePairs.join("&");
    }
    else {
        return null;
    }
}

FlashObject.prototype.write = function(elementId) {
	if(detectFlash(this.version) || this.doDetect=='false') {
		if (elementId) {
			document.getElementById(elementId).innerHTML = this.getHTML();
		} else {
			document.write(this.getHTML());
		}
	} else {
		if (this.redirect != "") {
			document.location.replace(this.redirect);
		} else {
			if (elementId) {
				document.getElementById(elementId).innerHTML = this.altTxt +""+ this.bypassTxt;
			} else {
				document.write(this.altTxt +""+ this.bypassTxt);
			}
		}
	}
}

function getFlashVersion() {
	var flashversion = 0;
	if (navigator.plugins && navigator.plugins.length) {
		var x = navigator.plugins["Shockwave Flash"];
		if(x){
			if (x.description) {
				var y = x.description;
	   			flashversion = y.charAt(y.indexOf('.')-1);
			}
		}
	} else {
		result = false;
	    for(var i = 15; i >= 3 && result != true; i--){
   			execScript('on error resume next: result = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
   			flashversion = i;
   		}
	}
	return flashversion;
}

function detectFlash(ver) {
	if (getFlashVersion() >= ver) {
		return true;
	} else {
		return false;
	}
}

// get value of querystring param
function getQueryParamValue(param) {
	var q = document.location.search;
	var detectIndex = q.indexOf(param);
	var endIndex = (q.indexOf("&", detectIndex) != -1) ? q.indexOf("&", detectIndex) : q.length;
	if(q.length > 1 && detectIndex != -1) {
		return q.substring(q.indexOf("=", detectIndex)+1, endIndex);
	} else {
		return "";
	}
}

/* add Array.push if needed */
if(Array.prototype.push == null){
	Array.prototype.push = function(item){
		this[this.length] = item;
		return this.length;
	}
}
