// Pop-up Window
// set the popup window width and height

var windowW=620 // wide
var windowH=850 // high

// set the screen position where the popup should appear

//var windowX = 260 // from left
//var windowY = 100 // from top
var windowX = (screen.width/2)-(windowW/2);
var windowY = (screen.height/2)-(windowH/2);

// set the url of the page to show in the popup

var urlPop = "large-flyer.php"

// set the title of the page

var title =  "..:: OC AfterDark Premier Event ::.."

// set this to true if the popup should close
// upon leaving the launching page; else, false

var autoclose = false

// ============================
// do not edit below this line
// ============================

s = "width="+windowW+",height="+windowH;
var beIE = document.all?true:false

function openFrameless(){
  if (beIE){
    NFW = window.open("","popFrameless","fullscreen,"+s)     
    NFW.blur()
    window.focus()       
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
    var frameString=""+
"<html>"+
"<head>"+
"<title>"+title+"</title>"+
"</head>"+
"<frameset rows='*,0' framespacing=0 border=0 frameborder=0>"+
"<frame name='top' src='"+urlPop+"' scrolling=auto>"+
"<frame name='bottom' src='about:blank' scrolling='no'>"+
"</frameset>"+
"</html>"
    NFW.document.open();
    NFW.document.write(frameString)
    NFW.document.close()
  } else {
    NFW=window.open(urlPop,"popFrameless","scrollbars,"+s)
    NFW.blur()
    window.focus() 
    NFW.resizeTo(windowW,windowH)
    NFW.moveTo(windowX,windowY)
  }   
  NFW.focus()   
  if (autoclose){
    window.onunload = function(){NFW.close()}
  }
}

//--------------------------------------------------------------------------------------------------------
// Form Input Validator Language settings
//--------------------------------------------------------------------------------------------------------

var msgNumber  = "Must be a number";
var msgEMail   = "Must be an e-mail address";
var msgURL     = "Must be a web address";
var msgDate    = "Must be a date";
var msgFillOut = "Please fill out";
var msgNoForm  = "Form does not exist";
var msgNoField = "Field does not exist";

//--------------------------------------------------------------------------------------------------------
// Functions
//--------------------------------------------------------------------------------------------------------

function _trim(str) {
  if(str) {
    str = str.replace(/^\s+/, "");
    str = str.replace(/\s+$/, "");
  }
  return str;
}

function _isDate(year, month, day) {
  month--;
  if(year < 100) year += 2000;
  var d = new Date(year, month, day);
  return ((day == d.getDate()) && (month == d.getMonth()) && (year == d.getFullYear()));
}

function checkForm() {
  var args = checkForm.arguments;
  var f = args[0];
  var msg = "";
  var arr, field, title, type, minLength, elem, val, cnt, nr, i, j;
  var format, d, day, month, year;

  var valid_url = /^(https?|ftp):\/\/([a-z0-9._-]+:[a-z0-9._-]+@)?[a-z0-9äöüÄÖÜ#._\/~% -]+(\?([a-z0-9_-]+(=[a-zA-Z0-99äöüÄÖÜß+%?_-]+&?)?)*)?$/i;
  var valid_mail = /^[a-z0-9._-]+@[a-z0-9äöüÄÖÜ.-]+\.[a-z]{2,4}$/i;

  if(document.forms[f]) {
    for(i = 1; i < args.length; i++) {
      arr = args[i].split(":");
      field = _trim(arr[0]);
      title = _trim(arr[1]);
      if(!title) title = field;
      type = _trim(arr[2].toLowerCase());
      minLength = _trim(arr[3]);
      elem = document.forms[f].elements[field];

      if(elem) {
        val = _trim(elem.value);

        if(val != "") {
          if(type == "number") {
            val = val.replace(",", ".");
            if(isNaN(val)) msg += '"' + title + '" ' + msgNumber + "\n";
          }
          else if(type == "mail" && val.search(valid_mail) == -1) msg += '"' + title + '" ' + msgEMail + "\n";
          else if(type == "url" && val.search(valid_url) == -1) msg += '"' + title + '" ' + msgURL + "\n";
          else if(type.indexOf("date") != -1) {
            if(type.indexOf("(") != -1) format = type.substr(type.indexOf("("));
            else format = "(dmy)";
            d = val;

            for(j = 1; j < format.length - 1; j++) {
              cnt = d.search(/[^0-9]/);
              if(cnt == -1) cnt = d.length;

              nr = d.substr(0, cnt);
              nr = parseInt(nr.replace(/^0/, ''));

              switch(format.charAt(j)) {
                case "d": day = nr; d = d.substr(cnt + 1); break;
                case "m": month = nr; d = d.substr(cnt + 1); break;
                case "y": year = nr; d = d.substr(cnt + 1); break;
              }
            }
            if(!_isDate(year, month, day)) msg += '"' + title + '" ' + msgDate + "\n";
          }
        }

        if(minLength) {
          if(elem.length) {
            if(elem.options) {
              for(j = cnt = 0; j < elem.options.length; j++) {
                if(elem.options[j].selected && elem.options[j].value != "") cnt++;
              }
            }
            else for(j = cnt = 0; j < elem.length; j++) {
              if(elem[j].checked) cnt++;
            }
          }
          else if(elem.type == "checkbox") cnt = elem.checked ? 1 : 0;
          else cnt = val.length;
          if(cnt < minLength) msg += msgFillOut + ' "' + title + '"\n';
        }
      }
      else msg += msgNoField + ': "' + field + '"\n';
    }

    if(msg) alert(msg);
    else document.forms[f].submit();
  }
  else alert(msgNoForm + ': "' + f + '"');
}

//--------------------------------------------------------------------------------------------------------




<!--

/***********************************************
* Required field(s) validation v1.10- By NavSurf
* Visit Nav Surf at http://navsurf.com
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function formCheck(formobj){
	// Enter name of mandatory fields
	var fieldRequired = Array("Event-Date", "name", "email");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("Event Date", "Name", "E-mail");
	// dialog message
	var alertMsg = "Ooops, you forgot to fill in some information:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
// -->

