//Refreshing the screen
var bolRefresh = false;
var refreshPage = '';
//setTimeout("RefreshRequired();",60000); 

String.prototype.trim = function() {
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};

function RefreshRequired()
{
	if(bolRefresh) 
	{	
		switch(refreshPage)
		{
			//Special refresh settings
		 	case 'FirstCommunion':
				refreshFirstCommunion();
				break;
			default:
				OpenPage(refreshPage,'');
				break;
		}
	}
}


//onLoad method for this page
function page_onLoad(requestID)
{
	//checkBrowser();
}

function findObj(n, d) { //object ID function for multiple browsers
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=findObj(n,d.layers[i].document);
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

function checkBrowser()
{
	var app = navigator.appName;

	/*Disable Butterfly for Netscape browsers*/
	if(app != "Microsoft Internet Explorer")
	{
		//alert(app);
		//findObj("EDVDesign").style.display = 'none';
		//findObj("Season").style.display = 'none';	
	}
}


function ExpandLevel(levelID)
{

	if(document.getElementById(levelID).style.display == 'none')
	{
		document.getElementById(levelID).style.display = 'block';
	}
	else
	{
		document.getElementById(levelID).style.display = 'none';
	}
	document.body.style.visibility = "hidden";
	document.body.style.visibility = "visible";
}

function OpenPage(requestID,sCriteria)
{
	if(sCriteria != null)
	{
		location = 'gateway.aspx?page=' + requestID + '&sCriteria=' + sCriteria;
		return;
	}
	location = 'gateway.aspx?page=' + requestID; 
}

function OpenPageHTML(requestID,sCriteria)
{
	if(sCriteria != null)
	{
		location = 'http://www.Gut-Middelstewehr.de/gateway.aspx?page=' + requestID + '&sCriteria=' + sCriteria;
		return;
	}
	location = 'http://www.Gut-Middelstewehr.de/gateway.aspx?page=' + requestID; 
}


var enlargeWin=0;
function Magnify(image, subtitle, left, top, width, height)
{
  if(enlargeWin)
  {
    if(!enlargeWin.closed) enlargeWin.close();
  }
 
  var URLStr = 'enlargement.asp?image=' + image + '&height=' + height + '&width=' + width + '&subtitle=' + subtitle;
  width += 20;
  height += 129;
  enlargeWin = open(URLStr, 'enlargeWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}

function isValidPhone(phoneStr,phoneType) {
// Checks for the following valid phone formats:
//Regular Expression for whitespace characters
	var phoneEmptyPat = /^\s*$/;
	var matchEmptyArray = phoneStr.match(phoneEmptyPat);
	
	if (matchEmptyArray != null){
		document.getElementById(phoneType).value = '';
		phoneStr = ''; //reset the phone number to an empty string
	}
	
	//Regular Expression for phone string pattern (999)999-9999 
	var phonePat = /^\(\d{3}\)\d{3}-\d{4}/;
	var matchArray = phoneStr.match(phonePat); // is the format ok?

	if (matchArray == null && (phoneStr.length != 0 || phoneStr != '')) {
		//alert('The telephone format has to be (999)999-9999!');
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage('The telephone format has to be <br/><b>(999)999-9999<b/>!');
		alertBox.size(250,300);
		alertBox.show(400,250);
		} 
	return true;
}

function clearPhoneMask(maskfield){
	if (maskfield.value.substring(0,13) == '(___)___-____') {
		maskfield.value = "";
		}
	}
// Set phone Mask ------------------------------
function setPhoneMask(maskfield){
	maskfield.value = '(___)___-____';
	maskfield.focus();
} 

function checkPhoneOnBlur(maskfield){
	if(maskfield.value == null || maskfield.value == '' || maskfield.value == '(___)___-____'){
		//Reinsert mask as a visual aid for the user
		maskfield.value = "(___)___-____";
	}
	else {
		//validate the entry
		//var validphone = isValidphone(maskfield.value);
		//if (validphone != true) maskfield.focus();
	}
}

// Automatic phoneMask filler to type phone without needing to type "( ) - "
function autoPhoneMask(maskfield,e){
	var vCurrentValue = maskfield.value;
	var vInputKey;
	vInputKey = String.fromCharCode(e.keyCode);
	if (maskfield.value.length == 0){
		if (String.fromCharCode(e.keyCode) != "("){
		//maskfield.value= maskfield.value + "(";
		}
	} else if (maskfield.value.length == 1) {
		if (maskfield.value.substring(0,1) != "("){
		maskfield.value= "(" + maskfield.value;
		}
	} else if (maskfield.value.length == 4) {
		if (String.fromCharCode(e.keyCode) != ")"){
		maskfield.value= maskfield.value + ")";
		}
	} else if (maskfield.value.length == 8) {
		if (String.fromCharCode(e.keyCode) != "-"){
		maskfield.value= maskfield.value + "-";
		}
	} else if (maskfield.value.length == 13) {
		if (String.fromCharCode(e.keyCode) != " "){
		maskfield.value= maskfield.value + " ";
		}
	}
}
function isValidEMail(obj){

	var emailStr = obj.value;
	//Regular Expression for whitespace characters
	var emailEmptyPat = /^\s*$/;
	var matchEmptyArray = emailStr.match(emailEmptyPat);
	
	if (matchEmptyArray != null){
		obj.value = '';
		emailStr = ''; //reset the email address to an empty string
	}

	//Regular Expression for string pattern including the "@" symbol and one "." after 
	var emailPat = /[\w\S]{2,}[@]{1}[\w\S]{2,}[\.]{1}[a-zA-Z]{2,}$/;
	var matchArray = emailStr.match(emailPat);

	if (matchArray == null && (emailStr.length != 0 || emailStr != '')) {
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage('The Email is not formatted correctly! Expected format: <br/><b>abc@company.com</b>');
		alertBox.size(250,300);
		alertBox.show(400,250);
		return false;
	}
	
	return true;
}

function requiredFields()
{
	var alertText = '';
	var inputElements = document.getElementsByTagName("input");
	for(var ii=0;ii<inputElements.length;++ii)
	{
		if(inputElements[ii].id.substring(0,3) == "req" && (inputElements[ii].value.length == 0 || inputElements[ii].value == '(___)___-____'))
		{
			alertText += '<strong>' + inputElements[ii].name + '</strong> is required!<br/>';
		}
	}
	if(alertText != '')
	{
		//alert(alertText);
		var alertBox = new EDVAlert(document.getElementById('myAlert'));
		alertBox.addMessage(alertText);
		alertBox.size(250,300);
		alertBox.show(580,330);
		return false;
	}
	return true;
}

function submitForm()
{
	if(!requiredFields()) return;
}

function submitAppForm()
{
	if(!requiredFields()) return;
}


//General functions
function EDVAlert(myDiv) {
	
	//Set HTML popup window (DIV)
	this.popup = myDiv;
	
	//Entries (HTML)
	this.messages = "";
	
	//Number of messages
	this.numMessages = 0;

	//Writing the required message box in html
	this.div = '<div style="position: absolute; background-color:#DFF293; top:0; left:0; width:300; height:300; border:1px solid #303A07;">';
	this.header = '<table cellpadding="5" cellspacing="0" border="0" width="100%" style="border:1px solid #303A07; background-color:#DFF293; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#DFF293);"><tr><td><table cellpadding="5" cellspacing="0" border="0" width="100%"><tr><td colspan="2" style="background-color:#303A07;"><font style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #ffffff; text-indent: 4px; text-decoration: none;">Alert:</font><img src="assets/images/transparent.gif" width="10"/></td></tr><tr><td colspan="2" height="5"/></tr><tr><td>';
	this.bodyDiv = '<div style="overflow-y:scroll; border-bottom: 1px solid #303A07; padding:5px; width:100%; height:150; scrollbar-base-color: #DFF293;scrollbar-track-color: #EFEFEF;	scrollbar-face-color: #DFF293;	scrollbar-highlight-color: #EFEFEF;	scrollbar-3dlight-color: #E3E8F9;scrollbar-darkshadow-color: #EFEFEF;scrollbar-shadow-color: #7E8FE2;scrollbar-arrow-color: #ffffff;">';
	this.bodyTable = '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td colspan="2" height="10"/></tr>';
	this.footer = '<tr><td colspan="2" height="20"/></tr></table></div></td></tr><tr><td colspan="2" align="center"><font style="font-family: Arial, Helvetica, sans-serif;	font-size: 9px; font-weight: normal; color: #303A07;	text-decoration:none;">To close this window, click on the link below!</font></td></tr><tr><td colspan="2" height="10"/></tr>';
	this.footerClose = '<tr><td colspan="2" align="center"><a id="AlertHide" href="javascript:void();" tabindex="1" onclick="document.getElementById(\'' + this.popup.id + '\').style.visibility = \'hidden\';"><font style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: normal; color: #303A07;	text-decoration: underline;">Close</font></a></td></tr></table></td></tr></table></div>';

	// ---------------------------------------------------------------------------------------------------
	// addMessage(): Adds an error entry to the SOARPopup Error Messagebox
	//
	// pErrorText: Error Text (can be HTML)
	// ---------------------------------------------------------------------------------------------------
	this.addMessage = function(pErrorText) {
		this.messages += '<tr><td colspan="2"><font style="font-family: Arial, Helvetica, sans-serif; '
			+ 'font-size: 14px; font-weight: normal; color: #303A07;text-decoration: none;">'
			+ '<font style="color:#303A07">'
			+ pErrorText
			+ '</font></font></td></tr>';
		this.numMessages += 1;
	}

	// ---------------------------------------------------------------------------------------------------
	// addConditionalMessage():	Adds an error entry to the Alert Error Messagebox, IF pCondition is true
	//							and set the style attribute of the flag to visible
	//
	// pCondition: Condition which is checked
	// pErrorText: Error Text (can be HTML)
	// pFlag: Flag item is set to visible if condition is true (optional!)
	// ---------------------------------------------------------------------------------------------------
	this.addConditionalMessage = function(pCondition,pErrorText,pFlagID) {
		if(pCondition)
		{
			if(pFlagID!=null) document.getElementById(pFlagID).style.visibility = 'visible';
			this.addMessage(pErrorText);
		}
		else
		{
			if(pFlagID!=null) document.getElementById(pFlagID).style.visibility = 'hidden';
		}
	}	

	// ---------------------------------------------------------------------------------------------------
	// size(): resizes the alert box
	// ---------------------------------------------------------------------------------------------------
	//	default height and width
	var vHeight = 300;
	var vWidth = 250;
	this.size = function(w,h)
	{
		if(w != null) vWidth = w;
		if(h != null) vHeight = h;
	}
	
	// ---------------------------------------------------------------------------------------------------
	// show(): shows the message box
	// x: X-Coordinate of popup window (default centered = 300)
	// y: Y-Coordinate of popup window (default centered = 300)
	// ---------------------------------------------------------------------------------------------------
	
	this.show = function(x,y) {
		
		htmlString = this.header + this.bodyDiv + this.bodyTable + this.messages + this.footer
			+ this.footerClose;
		
		if (x == null)x = 300;
		if (y == null)y = 300;
		
		this.popup.innerHTML = htmlString; 
		this.popup.style.left = x;
		this.popup.style.top = y;
		this.popup.style.width = vWidth;
		this.popup.style.height = vHeight;
		this.popup.style.visibility = 'visible';
	}
	
}


var openShow = 0;
function openShowroom(src,h,w)
{
	if(openShow)
	{
		if(!openShow.closed) 
		{
			openShow.close();
		}
	}
	openShow = window.open(src,'openShow','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=1,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=50,top=50')
	//openShow.focus();
}
var openStyle = 0;
function openStyles(src,h,w)
{
	if(openStyle)
	{
		if(!openStyle.closed) 
		{
			openStyle.close();
		}
	}
	openStyle = window.open(src,'openStyle','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=0,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=50,top=50')
	//openStyle.focus();
}

var openWin = 0;
function openURL(url,w,h,x,y)
{
	openWin = window.open(url,'openWin','menubar=0,scrollbars=1,toolbar=0,locationbar=0,resizable=1,personalbar=0,statusbar=0,width='+ w +',height=' + h + ',left=0,top=0')
	openWin.focus();
	
	//Set position
    //openWin.moveTo(x,y);
    return openWin; 
}

function openWindow()
{
	var url,w,h,x,y,args = openWindow.arguments;
	if(args.length == 0) return;
	url = args[0];
	
	if(args.length > 1) 
	{
		w = args[1];
		h = args[2];
	}
	else
	{
		//set width and height
		window.moveTo(0,0)
		if (document.all){
  			h = screen.availHeight-50;
  			w = screen.availWidth-50;
		}
		else if (document.layers||document.getElementById){
  			if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
    			h = window.outerHeight-20;
    			w = window.outerWidth-20;
  			}
		}
	}
	if(args.length > 3)
	{
	    x = args[3];
	    y = args[4];
	}
	else
	{
	    x = 0;
	    y = 0;
	}
	
	openURL(url,w,h,x,y);
}

function SetInActive()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Inactive</RequestID><ID>'+ sID +'</ID></Request>');
		
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}
}

function DeleteItem()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Delete</RequestID><ID>'+ sID +'</ID></Request>');
		
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}
}

function SetPriority()
{
	var sID = null;
	var bSelected = false;
	var colInput = document.all.tags('Input');
	for(var i = 0; i < colInput.length; i++)
	{
		if(colInput[i].id.substring(0,6) == 'ItemID' && colInput[i].checked)
		{
			sID = colInput[i].id.substring(6,colInput[i].id.length);
			bSelected = true;
		}
	}
	
	if(bSelected)
	{
		var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
		xmlDoc.async = false;
		xmlDoc.loadXML('<Request><RequestID>Priority</RequestID><Priority>'+ document.getElementById('Priority').value +'</Priority><ID>'+ sID +'</ID></Request>');
	
		SaveXML(xmlDoc);
	}
	else
	{
		alert('Select an item before \nperforming this action!');
	}

}
function HTMLDecode(s)
{
	return HTMLDecoding(s);
}
function HTMLDecoding(s){
	s = s.replace(new RegExp(/&lt;/gi), "<");
	s = s.replace(new RegExp(/&gt;/gi), ">");
	s = s.replace(new RegExp(/&amp;/gi), "&");
	return s;
}

function SaveXML(CommandContext){
	//Send client CommandContext
	//alert(CommandContext.xml); return;
	
	var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	xmlHTTP.open("POST","adminsave.asp", false);
	xmlHTTP.send(CommandContext);
	

	//Transform on the client
		var vResponseContext = xmlHTTP.ResponseText;
		var newDocument = document.open("text/html","replace");
		newDocument.write(vResponseContext);
		newDocument.close();
}

//The following function is for elements called "Hidden"
function HiddenDisplay(id)
{
	if(document.getElementById(id).style.display == 'block')
	{
		document.getElementById(id).style.display = 'none';
		document.getElementById('Handle'+id).src = 'assets/images/hidden_down.gif';
	}
	else
	{
		//Close all other link windows (hidden displays) first
		
		var divElements = document.getElementsByTagName("div");
		for(var i = 0; i < divElements.length; i++)
		{
			if(divElements[i].id.substring(0,10) == "LinkWindow")
			{
				divElements[i].style.display = 'none';
				document.getElementById('Handle'+divElements[i].id).src = 'assets/images/hidden_down.gif';
			}
		}
		
		document.getElementById(id).style.display = 'block';
		document.getElementById('Handle'+id).src = 'assets/images/hidden_up.gif';
	}
}

function XMLobj()
{
		//Multi Browser Support
		var xmlobj =false;

		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try 
		{
			//Newer IE
			xmlobj = new ActiveXObject("Msxml2.DOMDocument");
		} 
		catch (e) 
		{
			try 
			{
				//Older IE
				xmlobj = new ActiveXObject("Microsoft.DOMDocument");
			} 
			catch (ee) 
			{
				xmlobj = false;
			}
		}
		//Other Browsers
	
		if (!xmlobj) 
		{
			var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined');
			if(moz)
			{
				xmlobj = document.implementation.createDocument("", "doc", null);
			}
			else
				xmlobj = null;
		}

		
		return xmlobj;
}



function PrintPage()
{
	window.print();
}


function DateToday(){
	var iDate = new Date();
	var iMonth;
	var iDay;
	var iYear;
	iMonth = iDate.getMonth() + 1; 
	if (iMonth <= 9){iMonth = '0' + iMonth};
	iDay = iDate.getDate() + 1;
	if (iDay <= 9){iDay = '0' + iDay};
	iYear = iDate.getFullYear();
	iToday = iMonth + '/' + iDay + '/' + iYear;
	return iToday;
}


function userLogin(pageID)
{
    //Check whether username and password are entered
    var username = document.getElementById('un').value;
    var password = document.getElementById('pw').value;
    
    location = 'gateway.aspx?page=' + pageID + '&U=' + username + '&P=' + password; 
}

function playMovie(movie)
{
    var player = document.getElementById('MoviePlayer');
    //Reset Player
    player.innerHTML = '<img src="assets/images/transparent.gif" style="cursor:pointer;"/>';
    
    
    //Check if the plug-in exists
    if(!Plugin.isInstalled(Plugin.getPluginsForFileSuffix("mov")) || Plugin.getVersion(Plugin.getPluginsForFileSuffix("mov")) < "7") 
    { 
        //Set the QuickTime Player Needed image and download position.
        player.innerHTML = '<img src="assets/images/QuickTimeNeeded.gif" style="cursor:pointer;" onclick="openWindow(\'' + Plugin.getInfo(Plugin.getPluginsForFileSuffix("mov")).pluginsPage + '\',\'800\',\'600\')"/>';
    }
    else
    {
        //Run Movie
        player.innerHTML = '<EMBED SRC="assets/movies/' + movie + '" WIDTH="240" HEIGHT="196" AUTOPLAY="true" CONTROLLER="true" LOOP="false" PLUGINSPAGE="http://www.apple.com/quicktime/" style="background-color:#ff6cb6;">';
    }
    
}

function XMLHttpObj()
{
	//Multi Browser Support
		var myXmlhttp=false;
		var type = "IE";

		// JScript gives us Conditional compilation, we can cope with old IE versions.
		// and security blocked creation of the objects.
		try 
		{
			//Newer IE
			myXmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			type = "IE";
		} 
		catch (e) 
		{
			try 
			{
				//Older IE
				myXmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				type = "OldIE";
			} 
			catch (ee) 
			{
				myXmlhttp = false;
			}
		}
		//Other Browsers
		if (!myXmlhttp && typeof XMLHttpRequest != 'undefined') {
			myXmlhttp = new XMLHttpRequest();
			type = "Other";
		}
		
		return myXmlhttp;
		
}
//Multi Browser Support
var xmlhttp;
function edvMail()
{
	
	//Email Properties (defaults)
	var eTo = "info@edv-design.com";
	var eFrom = "";
	var eCC = "";
	var eBCC = "";
	var eBody = "";
	var eBodyFormat = "text";
	var eSubject = "";
	var eResponse = "";
	var url;
	
	this.To = function(sTo){eTo = sTo;}
	this.From = function(sFrom){eFrom = sFrom;}
	this.CC = function(sCC){eCC = sCC;}
	this.BCC = function(sBCC){eBCC = sBCC;}
	this.Body = function(sBody){eBody = sBody;}
	this.BodyFormat = function(sBodyFormat){eBodyFormat = sBodyFormat;}
	this.Subject = function(sSubject){eSubject = sSubject;}
	this.Response = function(){return eResponse;}
	this.URL = function(){return url;}
	

	this.Mail = function()
	{
		//Create url for email
		url = 'To=' + eTo;
		url += '&From=' + eFrom ;
		//url += '&CC=' + eCC;
		//url += '&BCC=' + eBCC;
		url += '&Body=' + eBody;
		//url += '&BodyFormat=' + eBodyFormat;
		url += '&Subject=' + eSubject;
		
		var win = openURL("http://www.edv-design.com/edvmail.asp?" + url,'200','30','300','300');
		//win.close();
		//Write Response
        eResponse = "Your Information was submitted successfully!";
	}
}



function MailContact()
{
	//alert('Service temporarily unavailable.\n Please contact us at (847)526-2900!');return;
    //Retrieve Form Elements
    var lastName, firstName, email, phone, subject, note;
    lastName = document.getElementById('LastName').value;
    firstName = document.getElementById('FirstName').value;
    email = document.getElementById('EMail').value;
    phone = document.getElementById('Telephone').value;
    subject = document.getElementById('Subject').value;
    note = document.getElementById('Note').value;
    
	var mailObj = new edvMail();
	mailObj.To("hilde.devries@t-online.de");
	mailObj.From("GutMiddelstewehr@edv-design.com");
	mailObj.Subject("Contact Request");
	mailObj.BodyFormat("html");
	var body = '<html><head/><body><p>The following contact request came from your website:</p>';
	body += '<table border="0" cellspacing="0" cellpadding="1" style="border:1px solid black">';
	body += '<tr><td width="100" style="color:white;background-color:black;">First Name</td><td style="border-bottom:1px solid black">' + firstName + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Last Name</td><td style="border-bottom:1px solid black">' + lastName + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Telephone</td><td style="border-bottom:1px solid black">' + phone + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">EMail</td><td style="border-bottom:1px solid black">' + email + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Subject</td><td style="border-bottom:1px solid black">' + subject + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Note</td><td style="border-bottom:1px solid black">' + HTMLDecode(note) + '</td></tr>';
	body += '</table></body></html>';
	mailObj.Body(body);
	mailObj.Mail();
}

function MailRequest()
{
    alert('Service zur Zeit nicht verfügbar.\n Bitte rufen sie uns unter (04926)350 an!');return;
    //Retrieve Form Elements
    var lastName, firstName, email, phone, subject, note;
    lastName = document.getElementById('LastName').value;
    firstName = document.getElementById('FirstName').value;
    email = document.getElementById('EMail').value;
    phone = document.getElementById('HomePhone').value;
    note = document.getElementById('Note').value;
    
	var mailObj = new edvMail();
	mailObj.To("hilde.devries@t-online.de");
	mailObj.From("GutMiddelstewehr@edv-design.com");
	mailObj.Subject("Proposal or Consultation Request");
	mailObj.BodyFormat("html");
	var body = '<html><head/><body><p>The following proposal request came from your website:</p>';
	body += '<table border="0" cellspacing="0" cellpadding="1" style="border:1px solid black">';
	body += '<tr><td width="100" style="color:white;background-color:black;">First Name</td><td style="border-bottom:1px solid black">' + firstName + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Last Name</td><td style="border-bottom:1px solid black">' + lastName + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Home Phone</td><td style="border-bottom:1px solid black">' + phone + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">EMail</td><td style="border-bottom:1px solid black">' + email + '</td></tr>';
	body += '<tr><td width="100" style="color:white;background-color:black;">Note</td><td style="border-bottom:1px solid black">' + HTMLDecode(note) + '</td></tr>';
	body += '</table></body></html>';
	mailObj.Body(body);
	mailObj.Mail();
}


function hasRadioSelected(radioName)
{
	for(var i=0; i<document.getElementsByName(radioName).length;i++)
	{
		if(document.getElementsByName(radioName)[i].checked == true)
		return true;
	}
	return false;
}
function selectedRadio(radioName)
{
	for(var i=0; i<document.getElementsByName(radioName).length;i++)
	{
		if(document.getElementsByName(radioName)[i].checked == true)
		return document.getElementsByName(radioName)[i];
	}
	return null;
}

function SubmitRating()
{
    
    if(!hasRadioSelected('grade'))
    {
        alert('Select your rating!');
        return;
    }
    document.getElementById('myGrade').value = selectedRadio('grade').value;
    
    document.getElementById('addcomment').submit();
    
    
}

function SubmitComment()
{
    //check whether a comment is inserted 
    if(document.getElementById('comment').value.trim().length == 0)
        {alert('Insert a comment!'); return;}
    //replace the "name" input with "anonymous" if the field is empty
    if(document.getElementById('name').value.trim().length == 0)
        document.getElementById('name').value = 'anonymous';
    
    document.getElementById('addcomment').submit();
    
}


function ViewEnlargement(e,img,title, pos)
{
	//Pos = position [L=Left, R=Right, T=Top, B=Bottom
	//X position is wherever mouse is.
	var posx = 0;
	var posy = 0;
	switch (pos)
	{
		case 'L':
			posx = -470;
			posy = 20;
			break;
		case 'R':
			posx = 20;
			posy = 20;
			break;
		case 'T':
			posx = -400;
			posy = -400;
			break;
		case 'TL':
			posx = -470;
			posy = -470;
			break;
		case 'B':
			posx = -400;
			posy = -300;
			break;
		default:
			break;	
	}
	
	if(!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx += e.pageX;
		posy += e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx += e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy += e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}

	//posx = imgObj.style.left;
    //posy = imgObj.style.top;

    
	document.getElementById('EnlargeImage').src = 'assets/images/loading.jpg';
	document.getElementById('EnlargeImage').src = 'assets/images/' + img;
	document.getElementById('EnlargedView').style.display='Block';
	document.getElementById('EnlargedView').style.left = posx;
	document.getElementById('EnlargedView').style.top = posy;
	document.getElementById('EnlargeTitle').innerHTML = title;
}
function HideEnlargement()
{
    document.getElementById('EnlargeImage').src = 'assets/images/loading.jpg';
	document.getElementById('EnlargedView').style.display='none';
}


