var couponwidthdefault='380';
var couponheightdefault='480';
var couponiddefault='149';

function validateForm(theForm)
	{
		// Customize these calls for your form
		// Start ------->
		if (!validFirstName(theForm.FirstName))
			return false;
		if (!validLastName(theForm.LastName))
			return false;
		if (!validRequired(theForm.Email,"email"))
			return false;
		if (!validEmail(theForm.Email,"Email",true))
			return false;
		// <--------- End
		validateCustomForm(theForm);
		return true;
}

function validVerify(formField,fieldLabel)
{
	var result = true;
	var verstring=(formField.value).toLowerCase();
	//alert(verstring);
	if (verstring != "marina")
	{
		alert('Verification was not successful. Please try again.');
		formField.focus();
		result = false;
	}
	
	return result;
}

function validateFormEmail(theForm)
	{
		// Customize these calls for your form
		// Start ------->
		if (!validRequired(theForm.name,"name"))
			return false;
		if (!validRequired(theForm.email,"your email"))
			return false;
		if (!validEmail(theForm.email,"your email",true))
			return false;
		if (!validRequired(theForm.destination,"destination email"))
			return false;
		if (!validEmail(theForm.destination,"destination email",true))
			return false;
		if (!validVerify(theForm.VERIFICATION,"verification"))
			return false;
		
		
		if (validateCustomForm(theForm)==false)
			return false;
		// <--------- End
		return true;
	}



// MENU'S

window.onload = mladdevents;
function mladdevents(){
	if(window.mlrunShim == true){
		var Iframe = document.createElement("iframe");
		Iframe.setAttribute("src","about:blank");
		Iframe.setAttribute("scrolling","no");
		Iframe.setAttribute("frameBorder","0");
		Iframe.style.zIndex = "2";
		Iframe.style.filter = 'alpha(opacity=0)';
	}
	var effects_a = new Array();
	var divs = document.getElementsByTagName('div');
	for(var j=0;j<divs.length;j++){
		if(divs[j].className.indexOf('mlmenu') != -1){
			var lis = divs[j].getElementsByTagName('li');
			for(var i =0;i<lis.length;i++){
				lis[i].onmouseover = mlover;
				lis[i].onmouseout = mloutSetTimeout;
				if(window.mlrunShim == true){
					lis[i].appendChild(Iframe.cloneNode(false));
				}
				if(lis[i].getElementsByTagName('ul').length > 0){
					lis[i].className += 'haschild';
					if(divs[j].className.indexOf('arrow') != -1){
						if(divs[j].className.indexOf('vertical') != -1 || lis[i].parentNode.parentNode.nodeName != 'DIV'){
							lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="vert">&rarr;</span>';
						}
						else{
							lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="horiz">&darr;</span>';
						}
					}
					else if(divs[j].className.indexOf('plus') != -1){
						lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="plus">+</span>';
					}
				}
				else{
					if(divs[j].className.indexOf('arrow') != -1){
						//This accounts for a wierd IE-specific bug in horizontal menus. CSS will set visibility: hidden;. This keeps the menu level(in IE)
						lis[i].getElementsByTagName('a')[0].innerHTML += '<span class="noshow">&darr;</span>';
					}
				}
				var uls = lis[i].getElementsByTagName('ul');
				for(var k=0;k<uls.length;k++){
					var found = 'no';
					for(var z=0;z<effects_a.length;z++){
						if(effects_a[z] == uls[k]){
							found = 'yes';
						}
					}
					if(found == 'no'){
						effects_a[effects_a.length] = uls[k];
						uls[k].style.zIndex = '100';
						mlEffectLoad(uls[k]);
					}
				}
			}
		}
	}
}
function mloutSetTimeout(e){
	if(!e){
		var the_e = window.event;
	}
	else{
		var the_e = e;
	}
	var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.toElement;
	if(reltg){
		var under = ancestor(reltg,this);
		if(under === false && reltg != this){
			//alert('got here');
			this.className = "";
			window.mlLast = this;
			var parent = this.parentNode;
			while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
				parent = parent.parentNode;
			}
			
			if(parent.className.indexOf('delay') != -1){
				//alert('delay mout');
				window.mlTimeout = setTimeout(function(){mlout()},500);
				//window.mlTimeout = setTimeout(function(){mlEffectLoad(parent);},600);
			}
			else{
				mlout();
			}
		}
		else
		{
			//alert('keep parent class');
			
			//temp = this.getElementsByTagName('li');
			//temp[0].color = "red";
			
			//alert('wait-1');
			this.className = "on";
			temp = this.getElementsByTagName('ul');
			for(var i =0;i<temp.length;i++){
				temp[0].className = "child";
			}
			//this.style.display = "100px";
			//alert('wait0');
		//	var parent = this.parentNode;
			//parent = parent.parentNode;
			//parent.style.color = "blue";
			//parent.className = "none";
			//alert('wait1');
			//while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
		//		parent = parent.parentNode;
			//}
			
		//	parent.className = "none";
		//	alert('wait2');
			//window.mlTimeout = setTimeout(function(){mlEffectLoad(parent);},600);
		}
	}
}
function mlout(){
if(window.mlLast==null)return false;
	var uls = window.mlLast.getElementsByTagName('ul');
	var sib;
	for(var i=0;i<uls.length;i++){
		mlEffectOut(uls[i]);
		if(window.mlrunShim == true){
			sib = uls[i];							
			while(sib.nextSibling && sib.nodeName != 'IFRAME'){
					sib = sib.nextSibling
			}
			sib.style.display = 'none';
		}
	}
	window.lastover = null;
}
function mlover(e){
	if(!e){
		var the_e = window.event;
	}
	else{
		var the_e = e;
	}
	the_e.cancelBubble = true;
	if(the_e.stopPropagation){
		the_e.stopPropagation();
	}
	clearTimeout(window.mlTimeout);
	//alert ('window.mlLast=' + window.mlLast + 'this='+ this + 'ancestor(this,window.mlLast)=' + ancestor(this,window.mlLast));
	if(window.mlLast && window.mlLast != this && ancestor(this,window.mlLast) == false){
		//alert('in mlover');
		//var parent = this.parentNode;		
		mlout();
		//mlEffectLoad(parent);
	}
	else{
		window.mlLast = null;
	}
	var reltg = (the_e.relatedTarget) ? the_e.relatedTarget : the_e.fromElement;
	var ob = this.getElementsByTagName('ul');
	var under = ancestor(reltg,this);
	if(ob[0] && under == false){
		if(window.lastover != ob[0]){
			if(window.mlrunShim == true){
				var sib = ob[0];
				while(sib.nextSibling && sib.nodeName != 'IFRAME'){
					sib = sib.nextSibling
				}
				ob[0].style.display = 'block';
				sib.style.top = ob[0].offsetTop+'px';
				sib.style.left = ob[0].offsetLeft-2+'px';
				sib.style.width = ob[0].offsetWidth+'px';
				sib.style.height = ob[0].offsetHeight-2+'px';
				sib.style.border = '1px solid red';
				sib.style.display = 'block';
			}
			mlEffectOver(ob[0],this);
			window.lastover = ob[0];
		}
	}
}
function mlSetOpacity(ob,level){
	if(ob){
		//level is between 0 and 10
		//need to convert to decimal for standard
		var standard = level/5;
		//need to convert to 0-100 scale for IE filter
		var ie = level*25;
		ob.style.opacity = standard;
		ob.style.filter = "alpha(opacity="+ie+")"
	}
}
function mlIncreaseOpacity(ob){
		var current = ob.style.opacity;
		if(lastob == ob && lastop == current){
			//mlout has not interfered
			current = current *5;
			var upone = current +1;
			mlSetOpacity(ob,upone);
			lastob = ob;
			lastop = upone/5;
		}
}
function mlIncreaseHeight(ob){
	var current = parseInt(ob.style.height);
	var newh = current + 1;
	ob.style.height = newh+'px';
}
function mlIncreaseWidth(ob){
	var current = parseInt(ob.style.width);
	var newh = current + 1;
	ob.style.width = newh+'px';
}
function mlBlink(ob){
	var newb = '1px solid red';
	var old = '';
	if(ob.style.border==old){
		ob.style.border=newb;
	}
	else{
		ob.style.border=old;
		ob.style.borderTop = '1px solid';
	}
}
function mlShake(ob){
	var newp = '5px';
	var old = '';
	if(ob.style.paddingLeft==old){
		ob.style.paddingLeft=newp;
	}
	else{
		ob.style.paddingLeft=old;
	}
}
function mlEffectOver(ob,parent){
	switch(ob.className){
		case 'fade':
			ob.style.display = 'block';
			if(ob.style.opacity == 0){
				lastob = ob
				lastop = 0;
				for(var i = 1;i<=5;i++){
					setTimeout(function(){mlIncreaseOpacity(ob)},i*50);
				}
				setTimeout(function(){ob.style.filter = ''},500);
			}
			break;
		case 'blink':
			ob.style.display = 'block';
			for(var i=0;i<10;i++){
				setTimeout(function(){mlBlink(ob)},i*50);
			}
			break;
		case 'shake':
			ob.style.display = 'block';
			for(var i=0;i<10;i++){
				setTimeout(function(){mlShake(ob)},i*50);
			}
			break;
		case 'blindv':
			ob.style.display = 'block';
			if(ob.offsetHeight){
				var height = ob.offsetHeight
				ob.style.height = '0px';
				ob.style.overflow = 'hidden';
				for(var i=0;i<height;i++){
					setTimeout(function(){mlIncreaseHeight(ob)},i*3);
				}
				setTimeout(function(){ob.style.overflow='visible';},height*3)
			}
			break;
		case 'blindh':
			ob.style.display = 'block';
			if(ob.offsetWidth){
				var width = ob.offsetWidth;
				ob.style.width = '0px';
				ob.style.overflow = 'hidden';
				for(var i=0;i<width;i++){
					setTimeout(function(){mlIncreaseWidth(ob)},i*3);
				}
				setTimeout(function(){ob.style.overflow='visible';},width*3)
			}
			break;
		default:
			ob.style.display = 'block';
			break;
	}
}
function mlEffectOut(ob){
	switch(ob.className){
		case 'fade':
			mlSetOpacity(ob,0);
			ob.style.display = 'none';
			break;
		case 'blink':
			ob.style.border = '';
			ob.style.display = 'none';
			break;
		case 'shake':
			ob.style.paddingLeft = '';
			ob.style.display = 'none';
			break;
		default:
			ob.style.display = 'none';
			break;
	}
}
function mlEffectLoad(ob){
	var parent = ob.parentNode;
	while(parent.parentNode && parent.className.indexOf('mlmenu') == -1){
		parent = parent.parentNode;
	}
	if(parent.className.indexOf('fade') != -1){
			ob.style.display = 'none';
			ob.className = 'fade';
			mlSetOpacity(ob,0);
	}
	else if(parent.className.indexOf('blink') != -1){
		ob.className = 'blink';
		ob.style.display = 'none';
	}
	else if(parent.className.indexOf('shake') != -1){
		ob.className = 'shake';
		ob.style.display = 'none';
	}
	else if(parent.className.indexOf('blindv') != -1){
		ob.className = 'blindv';
		ob.style.display = 'none';
	}
	else if(parent.className.indexOf('blindh') != -1){
		ob.className = 'blindh';
		ob.style.display = 'none';
	}
	else{
		ob.className = 'none';
		ob.style.display = 'none';
	}
}
function ancestor(child, parent){
	if(child==null)return false;//Saves checking elsewhere
	//This is a fix for a Firefox bug *gasp*
	//Aparantly causes a bug in Opera!
	//I see no choice but a browser detect. *sigh* I didn't want to have to do this.
	if(navigator.userAgent.indexOf('Gecko') != -1 && navigator.userAgent.indexOf('Opera') == -1){
		//This should only be run by Gecko based browsers. this code should be fine in everything but Opera so forge away browsers.
		var allc = parent.getElementsByTagName('*');
		for(var i= 0;i<allc.length;i++){
			if(allc[i] == child){
				return true;
			}
		}
	}
	else{
		//http://www.dynamicdrive.com/forums/showthread.php?t=12341 Thanks Twey!
		for(; child.parentNode; child = child.parentNode){
			if(child.parentNode === parent) return true;
		}
	}
	return false;
}



var agt=navigator.userAgent.toLowerCase();
///////////////////
// Browser Version
///////////////////
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_ns  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_ns2 = (is_ns && (is_major == 2));
var is_ns3 = (is_ns && (is_major == 3));
var is_ns4 = (is_ns && (is_major == 4));
var is_ns4up = (is_ns && (is_major >= 4));
var is_ns5 = (is_ns && (is_major == 5));
var is_ns5up = (is_ns && (is_major >= 5));

var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) && (agt.indexOf("msie 5.5")==-1));
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) || (agt.indexOf("msie 5.5")!=-1));
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);

var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);

var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);
////////////
// Platform
////////////
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
var is_win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) );
var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1));

var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
//var is_win2k = (agt.indexOf("windows nt 5.0")!=-1);
var is_win32 = (is_win95 || is_winnt || is_win98 || ((is_major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));

var is_os2   = ((agt.indexOf("os/2")!=-1) || (navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1));

var is_mac= (agt.indexOf("mac")!=-1);
var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1)));
var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1)));
/////////////////////////////////////
// Detect IE 4.5 on the mac
// Mucho Problemos with this browser
/////////////////////////////////////
var is_ie45mac  = (is_mac && is_ie && (agt.indexOf("msie 5.0")==-1) && (agt.indexOf("msie 5.5")==-1) && (agt.indexOf("msie 4.5")!=-1));

<!-- Begin
function addbookmark()
{
if (is_ie) {
var bookmarkurl="http://www.theperfectbreast.com";
var bookmarktitle="The Perfect Breast";
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
 }
 else {
 alert('Don\'t forget to bookmark www.theperfectbreast.com!');
 }
}
// End -->

function OpenCouponeBook()
{
	var cgi = new Object();
      cgi.http_host = location.host;
      cgi.http_user_agent = navigator.userAgent;
      cgi.http_cookie = document.cookie;
      cgi.https = (location.protocol == 'https:\/\/') ? 'on' : 'off';
      cgi.path_info = (location.pathname.indexOf('?') != -1) ?
location.pathname.substring(0, location.pathname.indexOf('?')) :
location.pathname;
      cgi.query_string = (location.search) ?
((location.search.indexOf('#') != -1) ? location.search.substring(1,
location.search.indexOf('#')) : location.search.substring(1)) : '';
      cgi.script_name = cgi.path_info;
      cgi.http_referer = document.referrer;
	var LinkLocation =
"http://www.etnasystems.com/coupon/?COUPONID=142&OriginalReferer=" +
getCookie("JSREF") + "&OriginalPage=" + cgi['script_name'];
//alert("link=" + LinkLocation);
	openWindow(LinkLocation, 'Coupon', '378', '500');
}