var actionDetail = new Array("Soft Comfort Laminate Textile", "<a href='javascript:defineTerm(1)'>High Toe Area</a>", "<a href='javascript:defineTerm(1)'>Roomy Toe Area</a>", "Flexible Profile Shoes", "Soft Leather Uppers", "Strong Velcro Adjustment", "Firm Heels For Ankle Support", "<a href='javascript:defineTerm(0)'>GLIDE and GRIP Profile Shoes</a>");

var romaText = new Array("Beige Textile", "Navy Textile", "Black Textile", "Wine Textile", "Brown Textile", "Grey Tartan Textile", "Blue Floral Textile", "Green Floral Textile", "Wine Floral Textile", "Navy Cotton Mesh", "Soft Navy Leather", "Soft Black Leather", "Extension Pieces Available", "BAMA SOFT STEP Cushion Insoles", "Easy Entry", "Easy Entry", "Various ROMA Shoes", "ROMA on Display")

var luccaText = new Array("Beige Textile", "Brown Textile", "Black Textile", "Blue Textile", "Grey Tartan Textile", "Blue Floral Textile", "Green Floral Textile", "Wine Floral Textile", "Black Leather", "Brown Leather", "Navy Leather", "BAMA SOFT STEP Cushion Insoles", "Extension Pieces Available", "LUCCA on Display", "Easy Entry", "Various LUCCA Shoes")

var pisaText = new Array("Beige Textile", "Black Textile", "Navy Textile", "Grey Tartan Textile", "Navy Mesh", "Black Leather", "Brown Leather", "BAMA SOFT STEP Cushion Insoles", "PISA on Display")

var genoaText = new Array("Black Textile", "Blue Textile", "Soft Navy Leather", "Extension Pieces Available")

var terms = new Array("Glide And Grip", "High Toe Area Available", "Safer Mobility", "Hallux Valgus/Overlapping Toes", "Oedema/Fluid Retention");

var definitions = new Array("<span class='bold'>Glide and Grip</span> is a sole design that has been specifically designed for those with mobility problems.<br /><br />Many similar shoes on the market today use \"Non-Slip\" soles but the problem is that these force the wearer to lift their feet off the ground as they walk.  As many with mobility problems will tell you, this is exceptionally difficult and can lead to serious injuries through trips and falls.<br /><br /><span class='bold'>Glide and Grip</span> is a special lightweight profile sole that allows the wearer to easily glide the shoe across the surface they are walking on and the shoes safely grip on landing.","Obtainable to order in either 11mm or 22mm extra height in the toe area to accommodate higher or swollen toe joints.  If you wish to order shoes with extra height <a href='contact.php'>contact us</a> before ordering.<br /><br /><span style='fontweight:bold'>***This will add to the cost of the footwear.***</span>", "<br /><br /><br />Where deformity is so severe as to render it impossible for elderly people to accommodate their feet in standard footwear, extra-depth and extra-width supportive footwear may be required.  Mobility is of prime importance in the elderly.  Senile ataxia, falls and fatigue can lead to a marked diminution of a person's self-confidence in their own ability to walk.  Careful attention to the feet is essential in this type of person in order to ensure that the foot is not used as an excuse to avoid beneficial exercise. Footwear must be lightweight, supportive, well fitting and should hold the heel back into the heel cup.<br /><h4 style='text-align:center'>Neale's Common Foot Disorders</h4>", "<div stye='margin-left:auto; margin-right:auto'><h2 style='margin-bottom:5px'>See styles LUCCA and PISA</h2><p style='text-align:center'><img src='Images/bunion.jpg' alt='Hallux Valgus/Overlapping Toes etc.'/></p><p style='text-align:center'><img src='Images/valgus_bunion.jpg' alt='Hallux Valgus/Overlapping Toes etc.'/></p></div>", "<div stye='margin-left:auto; margin-right:auto'><h2 style='margin-bottom:5px'>See style ROMA</h2><p style='text-align:center'><img src='Images/romaFoot.jpg' alt='Oedema/Fluid Retention'/></p></div>");


var counter = 0;
var romaCounter = 0;
var luccaCounter = 0;
var pisaCounter = 0;
var genoaCounter = 0;
var outputString = "";

function displayActions()
{
	document.getElementById("actionsPicture").innerHTML = '<a href="javascript:enlargeImage(\'action'+(counter+1)+'\')"><img src="Images/Actions/action'+(counter+1)+'.jpg" alt="Comfyfit Footwear - '+actionDetail[counter]+'" title="Comfyfit Footwear - '+actionDetail[counter]+'" width="300" height="225"/></a>';             
	document.getElementById("actionsText").innerHTML = actionDetail[counter];
    counter++;
	if(counter==8)
	{
		counter=0;
	}
	setTimeout('displayActions()', 6000);
}


function defineTerm(arrayPosition)
{
    newWindow = window.open("", "Definitions", "width=450, height=360, scrollbars=yes, status=yes, toolbar=no, location=no, resizable=yes");
	newWindow.document.write("<html><head><title>"+terms[arrayPosition]+"</title><link rel='stylesheet' href='CSS/main.css' type='text/css' media='all'  /></head><body class='definitionBack' style='margin:5px'><p class='definitions'>");
	newWindow.document.write(definitions[arrayPosition]);
	newWindow.document.write("</p></body></html>");
	newWindow.document.close();
}

function displayStyles()
{
	document.getElementById("romaSlidePic").innerHTML = '<a href="javascript:enlargeImage(\'roma'+(romaCounter+1)+'\')"><img src="Images/Shoes/Roma/roma'+(romaCounter+1)+'.jpg" alt="Comfyfit Footwear - '+romaText[romaCounter]+'" title="Comfyfit Footwear - '+romaText[romaCounter]+'" width="300" height="225"/></a>';             
	document.getElementById("romaSlideText").innerHTML = romaText[romaCounter];
    romaCounter++;
	if(romaCounter==18)
	{
		romaCounter=0;
	}
	
	document.getElementById("luccaSlidePic").innerHTML = '<a href="javascript:enlargeImage(\'lucca'+(luccaCounter+1)+'\')"><img src="Images/Shoes/Lucca/lucca'+(luccaCounter+1)+'.jpg" alt="Comfyfit Footwear - '+luccaText[luccaCounter]+'" title="Comfyfit Footwear - '+luccaText[luccaCounter]+'" width="300" height="225"/></a>';             
	document.getElementById("luccaSlideText").innerHTML = luccaText[luccaCounter];
    luccaCounter++;
	if(luccaCounter==16)
	{
		luccaCounter=0;
	}
	
	document.getElementById("pisaSlidePic").innerHTML = '<a href="javascript:enlargeImage(\'pisa'+(pisaCounter+1)+'\')"><img src="Images/Shoes/Pisa/pisa'+(pisaCounter+1)+'.jpg" alt="Comfyfit Footwear - '+pisaText[pisaCounter]+'" title="Comfyfit Footwear - '+pisaText[pisaCounter]+'" width="300" height="225"/></a>';             
	document.getElementById("pisaSlideText").innerHTML = pisaText[pisaCounter];
    pisaCounter++;
	if(pisaCounter==9)
	{
		pisaCounter=0;
	}
	
	document.getElementById("genoaSlidePic").innerHTML = '<a href="javascript:enlargeImage(\'genoa'+(genoaCounter+1)+'\')"><img src="Images/Shoes/Genoa/genoa'+(genoaCounter+1)+'.jpg" alt="Comfyfit Footwear - '+genoaText[genoaCounter]+'" title="Comfyfit Footwear - '+genoaText[genoaCounter]+'" width="300" height="225"/></a>';             
	document.getElementById("genoaSlideText").innerHTML = genoaText[genoaCounter];
    genoaCounter++;
	if(genoaCounter==4)
	{
		genoaCounter=0;
	}
	
	setTimeout('displayStyles()', 6000);
}



function enlargeImage(imageName)
{
	newWindow = window.open("", "Enlarged", "width=800, height=600, scrollbars=no, status=yes, toolbar=no, location=no, resizable=no");
	newWindow.document.write("<html><head><title>Enlarged Image - "+imageName+".jpg</title><link rel='stylesheet' href='CSS/main.css' type='text/css' media='all'  /></head><body class='enlargedImage'><img src='Images/Enlarged/"+imageName+".jpg' alt='Comfyfit Footwear - Enlarged Image' title='Comfyfit Footwear - Enlarged Image' />");
	newWindow.document.write("</body></html>");
	newWindow.document.close();
}

function checkform()
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var result=true;

	if(document.getElementById("contact").forename.value=="")
	{	
		result=false;
		document.getElementById("contact").forename.style.backgroundColor='#FFDDFF';
	}
	else
	{
		document.getElementById("contact").forename.style.backgroundColor='#FFFFFF';
	}
	
	if(document.getElementById("contact").surname.value=="")
	{	
		result=false;
		document.getElementById("contact").surname.style.backgroundColor='#FFDDFF';
	}
	else
	{
		document.getElementById("contact").surname.style.backgroundColor='#FFFFFF';
	}
	
	if(document.getElementById("contact").email.value=="")
	{	
		result=false;
		document.getElementById("contact").email.style.backgroundColor='#FFDDFF';
	}
	else
	{
		document.getElementById("contact").email.style.backgroundColor='#FFFFFF';
	}
	
	if(document.getElementById("contact").phone.value=="")
	{	
		result=false;
		document.getElementById("contact").phone.style.backgroundColor='#FFDDFF';
	}
	else
	{
		document.getElementById("contact").phone.style.backgroundColor='#FFFFFF';
	}
	
	if(document.getElementById("contact").comments.value=="")
	{	
		result=false;
		document.getElementById("contact").comments.style.backgroundColor='#FFDDFF';
	}
	else
	{
		document.getElementById("contact").comments.style.backgroundColor='#FFFFFF';
	}

	if(!filter.test(document.getElementById("contact").email.value))
	{
		document.getElementById("contact").email.style.backgroundColor='#FFDDFF';
		result= false;
	}
	else
	{
		document.getElementById("contact").email.style.backgroundColor='#FFFFFF';
	}
	
	if(document.getElementById("contact").category.value==("-- Select Enquiry Type --"))
	{
		document.getElementById("contact").category.style.backgroundColor='#FFDDFF';
		result= false;
	}
	else
	{
		document.getElementById("contact").category.style.backgroundColor='#FFFFFF';
	}
														  
	
	if(result==false)
	{
		alert("Please complete the highlighted fields correctly");
	}
	
	return result;
}

function showSizeGuide()
{
    newWindow = window.open("", "sizeGuide", "width=700, height=230, scrollbars=yes, status=yes, toolbar=no, location=no, resizable=no");
	newWindow.document.write("<html><head><title>Shoe Size Guide</title><link rel='stylesheet' href='CSS/main.css' type='text/css' media='all'  /></head><body style='text-align:center' class='definitionBack'><h3>Comfyfit International Shoe Size Guide</h3><p style='text-align:center'><table><tr><td style='width:80'>UK</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td></tr><tr> <td style='width:80'>European</td><td>34</td><td>35</td><td>37</td><td>38</td><td>39</td><td>41</td><td>42</td><td>43</td><td>44</td><td>46</td><td>47</td><td>48</td></tr><tr><td style='width:80'>US Male</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td></tr><tr><td style='width:80'>US Female</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td style='width:80'>Japanese (cm)</td><td>20.5</td><td>21.5</td><td>22.5</td><td>23.5</td><td>24.5</td><td>25.5</td><td>26.5</td><td>27.5</td><td>28.5</td><td>29.5</td><td>30.5</td><td>31</td></tr></table></p>");
	newWindow.document.write("</p></body></html>");
	newWindow.document.close();
}

function validateOrder(i)
{	
	if(document.getElementById("item"+i).os0.value=="not selected")
	{
		alert("You must select the shoe size before your order can be placed.");
		return false;
	}
	
	if(document.getElementById("item"+i).os1.value=="not selected")
	{
		alert("You must select the width of the shoe before your order can be placed.");
		return false;
	}
	
	if (document.getElementById("shipping"+i).value==0.00)
		return confirm("You have selected the United Kingom as the destination address for this item.\nIf this is incorrect please cancel and resubmit with the correct region.\nFailure to do so will result in your order being delayed until the correct shipping charge for the postal address has been paid.")
	else if(document.getElementById("shipping"+i).value==4.00)
		return confirm("You have selected Europe as the destination address for this item.\nIf this is incorrect please cancel and resubmit with the correct region.\nFailure to do so will result in your order being delayed until the correct shipping charge for the postal address has been paid.")
	else if(document.getElementById("shipping"+i).value=="not selected")
		{
			alert("You must select the region you would like your items to be delivered to.");
			return false;
		}
	else if(document.getElementById("shipping"+i).value==7.00)
		return confirm("You have selected the Rest of The World as the destination address for this item.\nIf this is incorrect please cancel and resubmit with the correct region.\nFailure to do so will result in your order being delayed until the shipping charge for the postal address has been paid.")
	else
		return true;		
}