﻿function openNewWindow(URL,w,h){

	var isMac = (navigator.appVersion.indexOf("Mac") != -1);
	var isNetscape = (!(navigator.appName.indexOf("Microsoft") != -1));
	var isVersion7 = (navigator.userAgent.indexOf("Netscape/7") != -1);

	var iwindowHand = window.open(URL, "document", "fullscreen=no,resizable=yes,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes,width="+w+",height="+h+",top=0,left=0");
	
	if (iwindowHand == null || typeof(iwindowHand)=="undefined")	
	    alert ("Please disable your popup blocker");
	else {
	    if (URL.indexOf('.gif')>=0) {
		    iwindowHand.document.open ();
		    iwindowHand.document.write ("<html><head></head><body><img src='" + URL + "' galleryimg='no'/></body></html>");
	    }
	    iwindowHand.focus();			    
	}
	
	return false;

    
}

function validateCurrency(sender, args)
{
    var value = args.Value.toString();    
    value = value.replace(/\s+/g,'');
    value = value.replace(/£+/g,'');
    value = value.replace(/,+/g,'');
    
    if (value=='' || isNaN (value))
        args.IsValid = false;
    else
        args.IsValid = true;
}

function popup(bookURL) 
	{
		
		var w, h;

		w = screen.width-10;
		h = screen.height-50;

		var isMac = (navigator.appVersion.indexOf("Mac") != -1);
		var isNetscape = (!(navigator.appName.indexOf("Microsoft") != -1));
		var isVersion7 = (navigator.userAgent.indexOf("Netscape/7") != -1);

		if (isMac)
		{
		bookURL += "&IsMac=1";
		}
		if (isNetscape)
		{
		bookURL += "&IsNetscape=1";
		}
		if (isVersion7)
		{
		bookURL += "&BrowserVersion=7";
		}
		if ((!isMac) && (isNetscape) && (isVersion7))
		{
		h -= 50;
		}
		if ((isMac) && (isNetscape))
		{
		h -= 55;
		}

		iwindowHand = window.open(bookURL, "webmag", "fullscreen=no,resizable=yes,status=yes,toolbar=no,menubar=no,location=no,width="+w+",height="+h+",top=0,left=0");
		iwindowHand.focus();	
				
		return false;
		
	}
	
	var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 

function copyDetails()
{
    document.getElementById("CardTitle").selectedIndex = document.getElementById("Title").selectedIndex;
    document.getElementById("CardFullName").value = document.getElementById("FullName").value;
    document.getElementById("CardAddress").value = document.getElementById("Address").value;
    document.getElementById("CardCityTown").value = document.getElementById("CityTown").value;
    document.getElementById("CardCounty").value = document.getElementById("County").value;
    document.getElementById("CardPostCode").value = document.getElementById("PostCode").value
}

function submitToEPDQ()
   {
       document.gotoEPDQ.submit();
   }
