function validateSave(form){
	clearElements();
	addElement(form.name,"strLastname", "text", "Last name", 1, 50, "");
	addElement(form.name,"strFirstname", "text", "First name", 1, 50, "");
	addElement(form.name,"strTitle", "text", "Title", 1, 50, "");
	addElement(form.name,"strCompany", "text", "Company", 1, 50, "");
	addElement(form.name,"strAddress", "text", "Address", 1, 50, "");
	addElement(form.name,"strCity", "text", "City", 1, 50, "");
	//addElement(form.name,"strProvince", "text", "Province", 1, 50, "");
	addElement(form.name,"strPostal", "text", "Postal Code", 1, 50, "");
	addElement(form.name,"strPhone", "text", "Telephone", 1, 50, "");
	addElement(form.name,"strEmail", "text", "E-mail", 1, 50, "");
	addElement(form.name,"strAnnual", "text", "Annual Sales", 1, 50, "");
	addElement(form.name,"strType", "text", "Type of business", 1, 50, "");
	return validateForm(form);	
}

function showPlayer(file){
	aBody = document.getElementsByTagName('body');
	if(aBody.length){
		aSize = getPageSize();
		//x = ((aSize[2]/2)-425)+171; 
		x = (aSize[2] - 425) / 2;
		oDiv = document.createElement("div");
		setStyle(oDiv,"background:#000;position:absolute;top:43px;left:"+x+"px;border:1px solid #ddd;z-index:10");
		oDiv.setAttribute("id","flashhomeplayer");
		oP = document.createElement("p");
		setStyle(oP,"text-align:right;padding-right:10px;padding-bottom:5px;margin:2px 0px;background:url('/_images/player_background.jpg') repeat-x;font-size:12px;");
		/*oAnchor = document.createElement("a");
		oAnchor.setAttribute("href","javascript:void(0)");
		oAnchor.setAttribute("onclick","playFile('amefullvid.flv', 640, 390)");
		oAnchor.appendChild(document.createTextNode("Full Overview Video"));
		setStyle(oAnchor,"color:#fff;padding-right:5px");
		oP.appendChild(oAnchor);*/
		oAnchor = document.createElement("a");
		oAnchor.setAttribute("href","javascript:void(0)");
		oAnchor.setAttribute("onclick","hidePlayer()");
		oAnchor.appendChild(document.createTextNode("Close"));
		setStyle(oAnchor,"color:#fff");
		oP.appendChild(oAnchor);
		oDiv.appendChild(oP);
		aBody[0].appendChild(oDiv);
		playFile(file,425,344);
	}
}

function setStyle(obj,style){
	if(document.all) obj.style.setAttribute("cssText",style);
	else obj.setAttribute("style",style);
}

function hidePlayer(){
	oDiv = document.getElementById("flashhomeplayer");
	if(oDiv!=null){
		oDiv.parentNode.removeChild(oDiv);	
	}
	oDiv = document.getElementById("overlay");
	if(oDiv!=null){
		oDiv.parentNode.removeChild(oDiv);	
	}
}

function playFile(file,width,height){
	oBody = document.getElementsByTagName("body")[0];
	var arr = getPageSize();
	oOverlay = document.createElement("div");
	oOverlay.style.height = arr[1]+'px';
	oOverlay.setAttribute("id","overlay");;
	oBody.appendChild(oOverlay);
	obj = document.getElementById('ameflashplayer');
    if(obj!=null) obj.parentNode.removeChild(obj);
	obj = document.getElementById('flashhomeplayer');
	if(!document.all){
		oObj = document.createElement("object");
		oObj.setAttribute("classid","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
		oObj.setAttribute("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0");
		oObj.setAttribute("width",width);
		oObj.setAttribute("height",height);
		oObj.setAttribute("id","ameflashplayer");
		oObj.setAttribute("align","center");
		oParam = document.createElement("param");
		oParam.setAttribute("name","allowScriptAccess");
		oParam.setAttribute("value","sameDomain");
		oObj.appendChild(oParam);
		oParam = document.createElement("param");
		oParam.setAttribute("name","allowFullScreen");
		oParam.setAttribute("value","false");
		oObj.appendChild(oParam);
		oParam = document.createElement("param");
		oParam.setAttribute("name","movie");
		oParam.setAttribute("value","http://www.youtube.com/v/R_au6akQk48&hl=en&fs=1");
		oObj.appendChild(oParam);
		oParam = document.createElement("param");
		oParam.setAttribute("name","quality");
		oParam.setAttribute("value","high");
		oObj.appendChild(oParam);
		oParam = document.createElement("param");
		oParam.setAttribute("name","bgcolor");
		oParam.setAttribute("value","#000000");
		oObj.appendChild(oParam);
		oParam = document.createElement("param");
		oParam.setAttribute("name","FlashVars");
		oParam.setAttribute("value","file="+file);
		oObj.appendChild(oParam);
		oEm = document.createElement("embed");
		oEm.setAttribute("src","http://www.youtube.com/v/R_au6akQk48&hl=en&fs=1");
		oEm.setAttribute("FlashVars","file="+file);
		oEm.setAttribute("quality","high");
		oEm.setAttribute("bgcolor","#000000");
		oEm.setAttribute("width",width);
		oEm.setAttribute("height",height);
		oEm.setAttribute("name","ameflashplayer");
		oEm.setAttribute("align","middle");
		oEm.setAttribute("allowScriptAccess","sameDomain");
		oEm.setAttribute("allowFullScreen","false");
		oEm.setAttribute("type","application/x-shockwave-flash");
		oEm.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer");
		oObj.appendChild(oEm);
		obj.appendChild(oObj);
	}else{
		obj.innerHTML += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"425\" height=\"344\" id=\"ameflashplayer\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"allowFullScreen\" value=\"false\" /><param name=\"movie\" value=\"http://www.youtube.com/v/R_au6akQk48&hl=en&fs=1\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#000000\" /><param name=\"FlashVars\" value=\"file="+file+"\" /><embed src=\"http://www.youtube.com/v/R_au6akQk48&hl=en&fs=1\" FlashVars=\"file="+file+"\" quality=\"high\" bgcolor=\"#000000\" width=\"425\" height=\"344\" name=\"ameflashplayer\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
	}
	//}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}