// mouse over
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function change1(picName,imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + ".src");
      document[picName].src= imgOn;
    }
 }
 
//preload image function
var myimages=new Array()
function preloadimages()
{
	for (i=0;i<preloadimages.arguments.length;i++)
	{
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}
//Enter path of images to be preloaded inside parenthesis. Extend list as desired.
preloadimages("images/bthomea.jpg","images/btproductsa.jpg","images/bthistorya.jpg","images/btthecompanya.jpg","images/btcontacta.jpg");


function header(argument)
{
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	if (argument=='home'){
		document.write('			<td width="265"><img src="images/logo.jpg" alt="Medelia Incorporated" width="264" height="82" border="0"></td>');
	}else{
		document.write('			<td width="265"><a href="index.htm"><img src="images/logo.jpg" alt="Medelia Incorporated" width="264" height="82" border="0"></a></td>');
	}
	document.write('			<td width="495" align="right"><img src="images/tag_line.jpg" width="427" height="50" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="10"><img src="images/blanker.gif" width="1" height="1" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
}



function links(argument)
{
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">')
	document.write('		<tr>')
	if (argument=='home'){
		document.write('			<td width="190"><img src="images/bthome_hover.jpg" alt="Home" name="home" id="home" width="187" height="25" border="0"></td>')
	}else{
		document.write('			<td width="190"><a href="index.htm"><img src="images/bthome_normal.jpg" alt="Home" name="home" id="home" width="187" height="25" border="0"></a></td>')
	}
	if (argument=='traning'){
		document.write('			<td width="190"><img src="images/bttraining_hover.jpg" alt="Training" name="training" id="training" width="187" height="25" border="0"></td>')
	}else{
		document.write('			<td width="190"><a href="training.htm"><img src="images/bttraining_normal.jpg" alt="Training" name="training" id="training" width="187" height="25" border="0"></a></td>')
	}
	if (argument=='consulting'){
		document.write('			<td width="190"><img src="images/btconsulting_hover.jpg" alt="Consulting" name="consulting" id="consulting" width="187" height="25" border="0"></td>')
	}else{
		document.write('			<td width="190"><a href="consulting.htm"><img src="images/btconsulting_normal.jpg" alt="Consulting" name="consulting" id="consulting" width="187" height="25" border="0"></a></td>')
	}
	if (argument=='womencertified'){
		document.write('			<td width="190"><img src="images/btwomencertified_hover.jpg" alt="Women Certified" name="womencertified" id="womencertified" width="187" height="25" border="0"></td>')
	}else{
		document.write('			<td width="190"><a href="http://www.womencertified.com" target="_blank"><img src="images/btwomencertified_normal.jpg" alt="WomenCertified" name="womencertified" id="womencertified" width="187" height="25" border="0"></a></td>')
	}
	document.write('		</tr>')
	document.write('	</table>')
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="2"><img src="images/blanker.gif" width="1" height="1" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
}



function footer(argument)
{
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="20"><img src="images/blanker.gif" width="1" height="1" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="100%" border="0">');
	document.write('		<tr>');
	document.write('			<td width="100%" height="5" class="bgred"><img src="images/blanker.gif" width="1" height="1" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="25" align="center"><img src="images/blanker.gif" width="1" height="1" border="0">');
	if (argument=='btmhome'){
		document.write('			<img src="images/blanker.jpg" width="1" height="1" border="0">');
	}else{
		document.write('			<a href="index.htm"><img src="images/btm_home_normal.jpg" alt="Home" name="btmhome" id="btmhome" width="36" height="15" border="0"></a>');
		document.write('			<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	}
	if (argument=='aboutmedelia'){
		document.write('			<img src="images/btm_aboutmedelia_hover.jpg" alt="About Medelia" name="aboutmedelia" id="aboutmedelia" width="86" height="15" border="0">');
	}else{
		document.write('			<a href="aboutmedelia.htm"><img src="images/btm_aboutmedelia_normal.jpg" alt="About Medelia" name="aboutmedelia" id="aboutmedelia" width="86" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='btmtraining'){
		document.write('			<img src="images/btm_training_hover.jpg" alt="Women Friendly Training" name="btmtraining" id="btmtraining" width="161" height="15" border="0">');
	}else{
		document.write('			<a href="training.htm"><img src="images/btm_training_normal.jpg" alt="Women Friendly Training" name="btmtraining" id="btmtraining" width="161" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='btmconsulting'){
		document.write('			<img src="images/btm_consulting_hover.jpg" alt="Women Friendly Consulting" name="btmconsulting" id="btmconsulting" width="175" height="15" border="0">');
	}else{
		document.write('			<a href="consulting.htm"><img src="images/btm_consulting_normal.jpg" alt="Women Friendly Consulting" name="btmconsulting" id="btmconsulting" width="175" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='btmcertified'){
		document.write('			<img src="images/btm_womencertified_hover.jpg" alt="WomenCertified" name="btmcertified" id="btmcertified" width="104" height="15" border="0"></td>');
	}else{
		document.write('			<a href="http://www.womencertified.com" target="_blank"><img src="images/btm_womencertified_normal.jpg" alt="WomenCertified" name="btmcertified" id="btmcertified" width="104" height="15" border="0"></a></td>');
	}
	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="100%" border="0">');
	document.write('		<tr>');
	document.write('			<td width="100%" height="1" class="bgdarkgrey"><img src="images/blanker.gif" width="1" height="1" border="0"></td>');
	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="25" align="center"><img src="images/blanker.gif" width="1" height="1" border="0">');
	if (argument=='aboutdelia'){
		document.write('			<img src="images/btm_aboutdelia_hover.jpg" alt="About Delia" name="aboutdelia" id="aboutdelia" width="71" height="15" border="0">');
	}else{
		document.write('			<a href="aboutdelia.htm"><img src="images/btm_aboutdelia_normal.jpg" alt="About Delia" name="aboutdelia" id="aboutdelia" width="71" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='keynotes'){
		document.write('			<img src="images/btm_keynotes_hover.jpg" alt="Keynotes" name="keynotes" id="keynotes" width="52" height="15" border="0">');
	}else{
		document.write('			<a href="keynotes.htm"><img src="images/btm_keynotes_normal.jpg" alt="Keynotes" name="keynotes" id="keynotes" width="52" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='press'){
		document.write('			<img src="images/btm_press_hover.jpg" alt="Press" name="press" id="press" width="28" height="15" border="0">');
	}else{
		document.write('			<a href="press.htm"><img src="images/btm_press_normal.jpg" alt="Press" name="press" id="press" width="28" height="15" border="0"></a>');
	}
	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
	if (argument=='contactus'){
		document.write('			<img src="images/btm_contactus_hover.jpg" alt="Contact Us" name="contactus" id="contactus" width="64" height="15" border="0">');
	}else{
		document.write('			<a href="contactus.htm"><img src="images/btm_contactus_normal.jpg" alt="Contact Us" name="contactus" id="contactus" width="64" height="15" border="0"></a>');
	}

	document.write('				<img src="images/blanker.gif" width="10" height="1" border="0"><img src="images/btm_divider.jpg" width="1" height="15" border="0"><img src="images/blanker.gif" width="10" height="1" border="0">');
		document.write('			<a href="DigitalMarketing/index.html"><img src="images/btm_digital_marketing.jpg" alt="Digital Marketing" name="Digital Marketing" id="Digital Marketing" width="99" height="15" border="0"></a></td>');

	document.write('		</tr>');
	document.write('	</table>');
	document.write('	<table cellpadding="0" cellspacing="0" width="760" border="0">');
	document.write('		<tr>');
	document.write('			<td width="760" height="60" class="textsize1" align="center">&copy; Medelia, Inc. 2008. All Rights Reserved.</td>');
	document.write('		</tr>');
	document.write('	</table>');
}


function puzzelpopup()
{
	window.open('puzzelpopup.htm','popuppuzzel','height=550,width=435,toolbar=no,menubar=no,statusbar=no,scrollbars=no,top=50,left=100,resizable=no');
}
function pricing()
{
	window.open('pricinginfopopup.htm','pricinginfo','height=600,width=570,toolbar=no,menubar=no,statusbar=no,scrollbars=yes,top=50,left=250,resizable=no');
}

function formvalidation()
{
	var submit = true;
	var errmessage = "Following fields are required:";
	var firstname = document.contact.fname.value;
	var lastname = document.contact.lname.value;
	var emailadress = document.contact.emailid.value;
	

	if (firstname == "")
	{
		errmessage += "\n- First Name";
		submit = false;
	}			

	if (lastname == "")
	{
		errmessage += "\n- Last Name";
		submit = false;
	}	
		
	if (emailadress == "")
	{
		errmessage += "\n- Email Address";
		submit = false;
	} 
	
	if (submit == true)
	{	
		return true;
	} 
	else
	{
		alert (errmessage);
		return false;
	}
}

function chknumber()
{
	var BookArray = ['African American', 'Hispanic', 'LGBT', 'Native American', 'South Asian', 'Special Needs', 'Women', 'All seven markets'];
	var OneCopy = 2500;
	var AdditionalCopy = 150;
	var AllSeven = 15750;	
	var Total = 0;
	
	var chk = true;
	
	if (shopping.book1.value.length > 0 && (isNumberString(shopping.book1.value) == false))
	{		
		chk = false;
	} else
	{
		if (shopping.book1.value.length > 0)
		{
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book1.value))
			} else
			{
				if (shopping.book1.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book1.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book2.value.length > 0 && (isNumberString(shopping.book2.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book2.value.length > 0)
		{	
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book2.value))
			} else
			{				
				if (shopping.book2.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book2.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book3.value.length > 0 && (isNumberString(shopping.book3.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book3.value.length > 0)
		{
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book3.value))
			} else
			{			
				if (shopping.book3.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book3.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book4.value.length > 0 && (isNumberString(shopping.book4.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book4.value.length > 0)
		{
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book4.value))
			} else
			{			
				if (shopping.book4.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book4.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book5.value.length > 0 && (isNumberString(shopping.book5.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book5.value.length > 0)
		{
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book5.value))
			} else
			{			
				if (shopping.book5.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book5.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book6.value.length > 0 && (isNumberString(shopping.book6.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book6.value.length > 0)
		{
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book6.value))
			} else
			{			
				if (shopping.book6.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book6.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book7.value.length > 0 && (isNumberString(shopping.book7.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book7.value.length > 0)
		{		
			if (shopping.book8.value >0)
			{
				Total += (AdditionalCopy * (shopping.book7.value))
			} else
			{			
				if (shopping.book7.value >1 )
				{
					Total += OneCopy * 1;	
					Total += (AdditionalCopy * (shopping.book7.value-1))
				} else
				{
					Total += OneCopy * 1;	
				}
			}
		}
	}
	
	if (shopping.book8.value.length > 0 && (isNumberString(shopping.book8.value) == false))
	{
		chk = false;
	} else
	{
		if (shopping.book8.value.length > 0)
		{
			if (shopping.book8.value >1 )
			{
				Total += AllSeven * 1;	
				Total += (AdditionalCopy * ((shopping.book8.value-1) * 7));
			} else
			{
				Total += AllSeven * 1;	
			}
		}
	}

	
	if (chk == false)
	{
		alert ("Please enter number only in quantity ...");	
		return false;
	} else
	{	
		shopping.Total.value =  Total;
		//alert (Total);
		return true;
	}
	 
}

function formvalidationshop()
{
	if (chknumber())
	{
		var submit = true;
		var errmessage = "Following fields are required:";
		var name = document.shopping.fname.value;
		var billingadd =  document.shopping.billingadd.value;
		var shippingadd = document.shopping.shippingadd.value;
		var phone = document.shopping.phone.value;
		var emailadress = document.shopping.emailid.value;
		
		if (name == "")
		{
			errmessage += "\n- Name";
			submit = false;
		}			
	
		if (billingadd == "")
		{
			errmessage += "\n- Billing Address";
			submit = false;
		}	
		if (shippingadd == "")
		{
			errmessage += "\n- Shipping Address";
			submit = false;
		}
		if (phone == "")
		{
			errmessage += "\n- Phone";
			submit = false;
		} 
		if (emailadress == "")
		{
			errmessage += "\n- Email Address";
			submit = false;
		} 
		
		if (submit == true)
		{	
			return true;
		} 
		else
		{
			alert (errmessage);
			return false;
		}		
	} else
	{
		return false;
	}
}	


function isNumberString (InString)  {
    if(InString.length==0) return (false);
    var RefString="1234567890";
    for (Count=0; Count < InString.length; Count++)  {
        TempChar= InString.substring (Count, Count+1);
        if (RefString.indexOf (TempChar, 0)==-1)  
            return (false);
    }
    return (true);
}



