var large=0;
var small=1;

function loadFlash (img,format){
	var file = new Array();
	var size = new Array();
	file[0] = 'images/roundmasklg';
	file[1] = 'images/roundmasksm';
	size[0] = ['250px','350px'];
	size[1] = ['170px','270px'];
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', size[format][0],
			'height', size[format][1],
			'src', 'roundmask',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'play', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', file[format],
			'FlashVars', 'img='+img
			); //end AC code
	}
}

var img= new Array();
img[4]= new Image();img[4].src="images/bg.gif";
img[5]= new Image();img[5].src="images/logo.gif";
img["buy"]= new Image();img["buy"].src="images/buy.gif";
img["buy-o"]= new Image();img["buy-o"].src="images/buy-o.gif";
img["home"]= new Image();img["home"].src="images/home.gif";
img["home-o"]= new Image();img["home-o"].src="images/home-o.gif";
img["share"]= new Image();img["share"].src="images/share.gif";
img["share-o"]= new Image();img["share-o"].src="images/share-o.gif";

function $(x){return document.getElementById(x);}
function firstChildElement(o){x=o.firstChild;while(x.nodeType!=1)x=x.nextSibling;return x;}

function nextSiblingElement(o,i){
	i = i || 1;
	for(j=0;j<i;j++){
		o=o.nextSibling;
		while(o.nodeType!=1)o=o.nextSibling;}
	return o;}

function prevSiblingElement(o,i){
	i = i || 1;
	for(j=0;j<i;j++){
		o=o.previousSibling;
		while(o.nodeType!=1)o=o.previousSibling;}
	return o;}

function getChildIndex(o,i){return nextSiblingElement(firstChildElement(o),i);}

var fce=firstChildElement;
var nse=nextSiblingElement;
var pse=prevSiblingElement;
var gci=getChildIndex;


function checkfields(o){
	for(i in o.elements)if(o.elements[i].className=='required' && o.elements[i].value==""){alert('Please fill in all required fields (marked with a "*").');return false;}
	return true;}


function validate(o){
	var order = "";
	var lastname = "";
	for(i=0;i<o.elements.length;i++){
		try{
			if( o.elements[i].className.search('required')!=-1){
				if(o.elements[i].type=="radio"){
					z=o.elements[o.elements[i].name];
					q = false;
					for(r=0;r<z.length;r++)if(z[r].checked==true){q=true;break;}
					if(!q){alert('Please make a selection for the required field: \n*'+ o.elements[i].name.replace('secure_','').replace('array_','').replace(/_/g,' ').replace( new RegExp('(\\+)','g'),' ' ) +'*');return false;}
				
				}else if(o.elements[i].nodeName.toLowerCase()=="select"){
					if(o.elements[i].selectedIndex==0){
						alert('Please make a selection for the required field: \n*'+ o.elements[i].name.replace('secure_','').replace('array_','').replace(/_/g,' ').replace( new RegExp('(\\+)','g'),' ' ) +'*');return false;
					}
				}else if(o.elements[i].value==''){
					alert('Please fill in required field: \n*'+ o.elements[i].name.replace('secure_','').replace('array_','').replace(/_/g,' ').replace( new RegExp('(\\+)','g'),' ' ) +'*');return false;
				}
			}else if (o.elements[i].length!=null)alert(o.elements[i].length);
		}catch(ex){;}
		try{if(o.elements[i].name!=lastname)order=order+o.elements[i].name+"|";lastname=o.elements[i].name;}catch(ex){;} //ignores sequential duplicates (radio sets)
	}
	var c=document.createElement('input');
	c.setAttribute("name","field_order");
	c.setAttribute("type","hidden");
	c.setAttribute("value",order);
	try{o.appendChild(c,null);}catch(ex){;}	
}
