﻿function checkemail(NewsLetter)
{
        if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.getElementById("Email_1").value))
            return "";
        else
        {
            return "WRONG";
        }
}


function CheckIServices()
{
    if (document.getElementById("Company").value=="")
    {
        document.getElementById("Company").focus();
        alert("You forgot to fill your Company Name.");
        document.getElementById("Company").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("Company").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("Name").value=="")
    {
        document.getElementById("Name").focus();
        alert("You forgot to fill your Name.");
        document.getElementById("Name").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("Name").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("OfficeAddress").value=="")
    {
        document.getElementById("OfficeAddress").focus();
        alert("You forgot to fill your Office Address.");
        document.getElementById("OfficeAddress").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("OfficeAddress").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("PostCode").value=="")
    {
        document.getElementById("PostCode").focus();
        alert("You forgot to fill your Postal code / City.");
        document.getElementById("PostCode").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("PostCode").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("MailAddress").value=="")
    {
        document.getElementById("MailAddress").focus();
        alert("You forgot to fill your E-mail.");
        document.getElementById("MailAddress").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("MailAddress").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("Phone").value=="")
    {
        document.getElementById("Phone").focus();
        alert("You forgot to fill your Telephone.");
        document.getElementById("Phone").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("Phone").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("Fax").value=="")
    {
        document.getElementById("Fax").focus();
        alert("You forgot to fill your Fax.");
        document.getElementById("Fax").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("Fax").style.borderColor = '#000000';
    }
    
    
    if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.getElementById("Email").value))
    {
        document.getElementById("Email").style.borderColor = '#000000';
    }
    else
    {
        document.getElementById("Email").focus();
        alert("You filled invalid E-mail address.");
        document.getElementById("Email").style.borderColor = '#FF0000';
        return false;
    }
    
}


function CheckNewsLetter()
{   
    if (document.getElementById("Company").value=="")
    {
        document.getElementById("Company").focus();
        alert("You forgot to fill your Company Name.");
        document.getElementById("Company").style.borderColor = '#FF0000';
        return false; 
    }
    else
    {
        document.getElementById("Company").style.borderColor = '#000000';
    }
    
    
    if (document.getElementById("Reader_1").value=="")
    {
        document.getElementById("Reader_1").focus();
        alert("You forgot to fill your Name.");
        document.getElementById("Reader_1").style.borderColor = '#FF0000';
        return false;
        
    }
    else
    {
        document.getElementById("Reader_1").style.borderColor = '#000000';
    }
    
    if (document.getElementById("Email_1").value=="")
    {
        document.getElementById("Email_1").focus();
        alert("You forgot to fill your E-mail address.");
        document.getElementById("Email_1").style.borderColor = '#FF0000';
        return false;
    }

    if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.getElementById("Email_1").value))
    {
        document.getElementById("Email_1").style.borderColor = '#000000';
    }
    else
    {
        document.getElementById("Email_1").focus();
        alert("You filled invalid E-mail address.");
        document.getElementById("Email_1").style.borderColor = '#FF0000';
        return false;
    }
    
    if (document.getElementById("Reader_2").value=="")
    {
        if (document.getElementById("Email_2").value=="")
        {
            document.getElementById("Email_2").style.borderColor = '#000000';
            document.getElementById("Reader_2").style.borderColor = '#000000';
        }
        else
        {
            if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.getElementById("Email_2").value))
            {
                alert("You forgot to fill 2end name.");
                document.getElementById("Email_2").style.borderColor = '#000000';
                document.getElementById("Reader_2").style.borderColor = '#FF0000';
                return false;
            }
            else
            {
                document.getElementById("Email_2").focus();
                alert("You filled invalid 2end E-mail address and no 2end name.");
                document.getElementById("Email_2").style.borderColor = '#FF0000';
                document.getElementById("Reader_2").style.borderColor = '#FF0000';
                return false;
            }
        }
    }
    else
    {
        if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_2.value))
        {
            document.getElementById("Email_2").style.borderColor = '#000000';
            document.getElementById("Reader_2").style.borderColor = '#000000';
        }
        else
        {
            document.getElementById("Email_2").focus();
            alert("You filled invalid 2end E-mail address.");
            document.getElementById("Email_2").style.borderColor = '#FF0000';
            document.getElementById("Reader_2").style.borderColor = '#000000';
            return false;
        }
    }
    
    if (document.getElementById("Reader_3").value=="")
    {
        if (document.getElementById("Email_3").value=="")
        {
            document.getElementById("Email_3").style.borderColor = '#000000';
            document.getElementById("Reader_3").style.borderColor = '#000000';
        }
        else
        {
            if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_3.value))
            {
                alert("You forgot to fill 3th name.");
                document.getElementById("Email_3").style.borderColor = '#000000';
                document.getElementById("Reader_2").style.borderColor = '#FF0000';
                return false;
            }
            else
            {
                document.getElementById("Email_3").focus();
                alert("You filled invalid 3th E-mail address and no 3th name.");
                document.getElementById("Email_3").style.borderColor = '#FF0000';
                document.getElementById("Reader_3").style.borderColor = '#FF0000';
                return false;
            }
        }
    }
    else
    {
        if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_3.value))
        {
            document.getElementById("Email_3").style.borderColor = '#000000';
            document.getElementById("Reader_3").style.borderColor = '#000000';
        }
        else
        {
            document.getElementById("Email_3").focus();
            alert("You filled invalid 3th E-mail address.");
            document.getElementById("Email_3").style.borderColor = '#FF0000';
            document.getElementById("Reader_3").style.borderColor = '#000000';
            return false;
        }
    }
    
    
    if (document.getElementById("Reader_4").value=="")
    {
        if (document.getElementById("Email_4").value=="")
        {
            document.getElementById("Email_4").style.borderColor = '#000000';
            document.getElementById("Reader_4").style.borderColor = '#000000';
        }
        else
        {
            if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_4.value))
            {
                alert("You forgot to fill 4th name.");
                document.getElementById("Email_4").style.borderColor = '#000000';
                document.getElementById("Reader_4").style.borderColor = '#FF0000';
                return false;
            }
            else
            {
                document.getElementById("Email_4").focus();
                alert("You filled invalid 4th E-mail address and no 4th name.");
                document.getElementById("Email_4").style.borderColor = '#FF0000';
                document.getElementById("Reader_4").style.borderColor = '#FF0000';
                return false;
            }
        }
    }
    else
    {
        if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_4.value))
        {
            document.getElementById("Email_4").style.borderColor = '#000000';
            document.getElementById("Reader_4").style.borderColor = '#000000';
        }
        else
        {
            document.getElementById("Email_4").focus();
            alert("You filled invalid 4th E-mail address.");
            document.getElementById("Email_4").style.borderColor = '#FF0000';
            document.getElementById("Reader_4").style.borderColor = '#000000';
            return false;
        }
    }
    
    
    if (document.getElementById("Reader_5").value=="")
    {
        if (document.getElementById("Email_5").value=="")
        {
            document.getElementById("Email_5").style.borderColor = '#000000';
            document.getElementById("Reader_5").style.borderColor = '#000000';
        }
        else
        {
            if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_5.value))
            {
                alert("You forgot to fill 5th name.");
                document.getElementById("Email_5").style.borderColor = '#000000';
                document.getElementById("Reader_5").style.borderColor = '#FF0000';
                return false;
            }
            else
            {
                document.getElementById("Email_5").focus();
                alert("You filled invalid 5th E-mail address and no 5th name.");
                document.getElementById("Email_5").style.borderColor = '#FF0000';
                document.getElementById("Reader_5").style.borderColor = '#FF0000';
                return false;
            }
        }
    }
    else
    {
        if (/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test(document.NewsLetter.Email_5.value))
        {
            document.getElementById("Email_5").style.borderColor = '#000000';
            document.getElementById("Reader_5").style.borderColor = '#000000';
        }
        else
        {
            document.getElementById("Email_5").focus();
            alert("You filled invalid 5th E-mail address.");
            document.getElementById("Email_5").style.borderColor = '#FF0000';
            document.getElementById("Reader_5").style.borderColor = '#000000';
            return false;
        }
    }
    
}

//here you place the ids of every element you want.
var ids=new Array('9713', '9714','9715','9716');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function ShowHide(div)
{
    var thisLevel = document.getElementById(div);

    if (thisLevel.style.display == "none")
    {
        thisLevel.style.display = "block";
    }
    else
    {
        var thisLevel = document.getElementById(div);
        thisLevel.style.display = "none";
    }
}