function showCVV2() {
	var newWin = window.open('http://www.simplyshortbreaks.com/1/cvv2.html','cvv2','resizable=no,height=500,width=500,toolbars=no,scrollbars=yes');
}
/////////////////////////////////////////////////////////////////////////////////////////////
//getElementsByClassName
/////////////////////////////////////////////////////////////////////////////////////////////

function getElementsByClassName(node, classname){
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Javascript Pop-up window
/////////////////////////////////////////////////////////////////////////////////////////////
function popup(w,h,trgt)
{
	var wHeight, wWidth, vertPos, horzPos;
	if (document.all)
		{	
		wHeight = screen.Height;
		wWidth = screen.Width;
		}
	else 
		{
		wHeight = window.innerHeight;
		wWidth = window.innerWidth;
		}
		
	horzPos = ((wWidth/2) - (w/2));
	vertPos = ((wHeight/2) - (h/2));
	
	poppedwindow = window.open("" + trgt + "","PoppedWindow","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + w + ",height=" + h + "");
	poppedwindow.moveTo(horzPos, vertPos);
	if (window.focus) {poppedwindow.focus();}
	wHeight = 0;
	wWidth = 0;
	vertPos = 0;
	horzPos = 0;
}

function popup2(w,h,trgt) 
{
	var wHeight, wWidth, vertPos, horzPos;
	if (document.all)
		{	
		wHeight = screen.Height;
		wWidth = screen.Width;
		}
	else 
		{
		wHeight = window.innerHeight;
		wWidth = window.innerWidth;
		}
		
	horzPos = ((wWidth/2) - (w/2));
	vertPos = ((wHeight/2) - (h/2));
	
	poppedwindow = window.open("" + trgt + "","PoppedWindow","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=" + w + ",height=" + h + "");
	poppedwindow.moveTo(horzPos, vertPos);
	if (window.focus) {poppedwindow.focus();}
	wHeight = 0;
	wWidth = 0;
	vertPos = 0;
	horzPos = 0;
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Validate Contact Us
/////////////////////////////////////////////////////////////////////////////////////////////

function validate_contact_us(){
var oh = 0;
var oj = 0;
document.getElementById("name_fail").innerHTML = "";
document.getElementById("tel_fail").innerHTML = "";
document.getElementById("email_fail").innerHTML = "";
document.getElementById("enquiry_fail").innerHTML = "";

document.getElementById("frm_name").className = "";
document.getElementById("frm_tel").className = "";
document.getElementById("frm_email").className = "";
document.getElementById("frm_enquiry").className = "";

if (document.getElementById("frm_name").value == ""){document.getElementById("name_fail").innerHTML = document.getElementById("name_fail").innerHTML + "A Name Must Be Entered<br>"; oh = 1; document.getElementById("frm_name").className = "error";}
if (document.getElementById("frm_email").value == ""){document.getElementById("email_fail").innerHTML = document.getElementById("email_fail").innerHTML + "An Email Address Must Be Entered<br>"; oh = 1; oj = 1; document.getElementById("frm_email").className = "error";}
if (oj == 0){
	if (emailcheck(document.getElementById('frm_email').value) == false){document.getElementById("email_fail").innerHTML = document.getElementById("email_fail").innerHTML + "Email Address invalid<br>"; oh = 1;}
}
if (document.getElementById("frm_enquiry").value == ""){document.getElementById("enquiry_fail").innerHTML = document.getElementById("enquiry_fail").innerHTML + "An Enquiry Must Be Entered<br>"; oh = 1; document.getElementById("frm_enquiry").className = "error";}
if (oh == 1){return false;}
document.getElementById("posted").value = "1";
document.getElementById("frm_contact").submit();
return false;
}
/////////////////////////////////////////////////////////////////////////////////////////////
//Email Validation
/////////////////////////////////////////////////////////////////////////////////////////////
function emailcheck(str){
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length -1;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr - 3){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr - 1){
		return false
	}
	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }
	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }
	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	 if (str.indexOf(" ")!=-1){
		return false
	 }
	 return true			
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Clear Email Textbox onFocus
/////////////////////////////////////////////////////////////////////////////////////////////
function clear_email(){
	if(document.getElementById("txtEmail").value == "Email Address"){
		document.getElementById("txtEmail").value = ""
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////
//Validate Subscription to Newsletter
/////////////////////////////////////////////////////////////////////////////////////////////
function popper(){
	if(document.getElementById("txtEmail").value == "Email Address" || document.getElementById("txtEmail").value == ""){
		alert("THERE HAS BEEN AN ERROR...\n"+
		"---------------------------------------------------------------------------\n\n"+
		"Please Enter an Email Address.\n\n"+
		"---------------------------------------------------------------------------");
	return false;
	}
	if(emailcheck(document.getElementById("txtEmail").value) == false){
		alert("THERE HAS BEEN AN ERROR...\n"+
		"---------------------------------------------------------------------------\n\n"+
		"Email Address Invalid.\n\n"+
		"---------------------------------------------------------------------------");
		return false;
	}
	popup(770, 580, "about:blank");
	setTimeout('document.getElemebtById("frm_newsletter").submit();',500)
}
function validate_email(){
	return true;
}