function runarafLogo()
{
    document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=230 height=100 id=araf align=middle />\n');
    document.write('<param name=allowScriptAccess value=sameDomain />\n');
    document.write('<param name=movie value=\"http://www.aisha-ali.com/araf/images/araf.swf\">\n');
    document.write('<param name=quality value=high /><param name=bgcolor value=#000000 />');
    document.write('<embed src=\"http://www.aisha-ali.com/araf/images/araf.swf\" quality=high bgcolor=#000000 width=230 height=100 type=\"application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer\" />');
    document.write('</object>\n');
}

/* Displays black logo on the white order page */
function runarafshopLogo()
{
    document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=230 height=100 id=arafshop align=middle');
    document.write('<param name=allowScriptAccess value=sameDomain />\n');
    document.write('<param name=movie value=\"images/arafshop.swf\">\n');
    document.write('<param name=quality value=high /><param name=bgcolor value=#FFFFFF />');
    document.write('<embed src=\"images/arafshop.swf\" quality=high bgcolor=#FFFFFF width=230 height=100 type=\"application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer\" />');
    document.write('</object>\n');
}

/* Popup window */

/* Popup window; not used */
function popWindow(url,params){
myWin=window.open(url,title,params,true)
;
myWin.focus();
}

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
  }
function closePopWin(){    // close pop-up window if it is open 
  if (navigator.appName != "Microsoft Internet Explorer" 
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close() 
  }
function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }
  
/* for closing popup windows; */
function closeIt() 
{
  close();
}
/* End of popup window */

/* Window for large graphic, order form */
function avWindow(url,width){
myWin=window.open(url,"item","width=750,height=720,screenx=50,screeny=5,resizable=yes,alwaysRaised", true)
myWin.focus();
}

/* Window for EasyCart */
function ordWindow(url){
myWin=window.open(url,"order")
myWin.focus();
}


/* For displaying linked page in previous window (order form) */
function loadinprev(url, closeSelf)
{
	self.opener.location = url;
	if(closeSelf) self.close();
}

//JavaScript function for virtual footer
//Update this function only to change footer on site
now = new Date
thisYear=now.getYear();
if (thisYear < 1900) 
{
thisYear= thisYear + 1900;
}

function printVirtualFooter()
{
//Contacts
var anchortext = "Aisha Ali"; 
var mailpart1 = "aisha"; 
var mailpart2 = "aisha-ali.com"; 

//Contact 2
var anchortext2 = "Mardi Rollow"; 
var mailpart12 = "webmaster"; 
function send2()
{
document.write("<a href=" + "mail" + "to:" + mailpart12 + "@" + mailpart2 + ">" + anchortext2 + "</a>") 
}

var ml1 = "<a href=" + "mail" + "to:" + mailpart1 + 
"@" + mailpart2 + ">" + anchortext + "</a>";
var ml2 = "<a href=" + "mail" + "to:" + mailpart12 + 
"@" + mailpart2 + ">" + anchortext2 + "</a>";

document.write('<table width="90%" cellpadding="0" cellspacing="0" align="center">');
document.write('<tr><td align="left" class="footer">');
document.write('<span class="navcolor">Copyright &copy; 1998–' + thisYear + ' ' + ml1 + '</span>');document.write('</td><td align="center" class="footer">');
document.write('<span class="navcolor">All rights reserved</span></td>');
document.write('<td class="footer" align="right">');
document.write('<span class="navcolor">Web Design:</span> ' + ml2);
document.write('</td><td width=40></td></tr></table>');
}

//Contact 7
var anchortext7 = "Contact"; 
var mailpart17 = "araf"; 
var mailpart2 = "aisha-ali.com"; 
function sendseven()
{
document.write("<a href=" + "mail" + "to:" + mailpart17 + 
"@" + mailpart2 + ">" + anchortext7 + "</a>") 
}

/* For sound clips on large_graphic.cgi */
function playSound()
{
document.write('<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=550 height=400 id=sound_test align=middle>');
document.write('<param name=allowScriptAccess value=sameDomain />\n');
document.write('<param name=movie value=\"sound_test.swf\">\n');
document.write('<param name=quality value=high /><param name=bgcolor value=#ffffff />');
document.write('<embed src=\"sound_test.swf\" quality=high bgcolor=#ffffff width=550 height=400  name=sound_test align=middle allowScriptAccess=sameDomain type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />');
document.write('</object>\n');
}

/* For PPOrder_Form window */
function origWindow(url)
{
myWin=window.open(url,"main")
this.close();
myWin.focus();
} 

/* orderform.php validation is in the page */

/* Validate email address on order form */
function emailCheck (emailStr) {
/* Does email address match 
   the user@domain format; separates 
   the user name from the domain. */
var emailPat=/^(.+)@(.+)$/
/* Pattern for matching all special characters, 
   not allowed in the address,
   including ( ) < > @ , ; : \ " . [ ];  */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* Characters allowed in a user name or domain name  
   by stating which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* Pattern applies if user name is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* For domains that are IP addresses, rather than symbolic names,
   e.g., joe@[123.124.233.4] is a legal email address. 
   NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   A word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// Pattern that describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* Pattern that describes the structure of a standard symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

/* Determine whether the email address is valid. */

/* Pattern breaks up user@domain into
   pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
  /* This address doesn't fit the standard format */
	alert("Email address does not match standard format (check @ and .'s).")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if user is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("Invalid email user name.")
    return false
}

/* Validate IP address if the email address is at an IP address */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Invalid IP address.")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Invalid domain name.")
    return false
}

/* domain name seems valid; make sure that it ends in a
   three-letter word (com, edu, gov, etc.) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Break up the domain to get a count of 
   how many atoms it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two-letter or three-letter word.
   alert("The email address must end in a three-letter domain, or two-letter country code.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This email address is missing a host name."
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid
return true;
}
// end of email checking routine

// error checking for form
function formCheck(formobj){
	var fieldRequired = new Array;
	var fieldDescription = new Array;
	// Enter name of mandatory fields
	var fieldRequired = Array("firstname", "lastname", "address", "city", "state", "postalcode", "country", "email");
	// Enter field description to appear in the dialog box
	var fieldDescription = Array("First Name", "Last Name", "Address", "City", "State", "Zip/postal code", "Country", "Email address");
	// dialog message
	var alertMsg = "Please complete the following fields:\n";	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];

		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += "   " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += "   " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += "   " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += "   " + fieldDescription[i] + "\n";
				}
			}
		}
		if ( (obj.name == "quantity") && (obj.value >= 15) ) {
			alert("Quantity may not be over 14.");
			return false;
		}
	}
	

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

