// FADER

// document.write("<style type='text/css'>#thephoto {visibility:hidden;}</style>");

function initImage() {
	imageId = 'thephoto';
	image = document.getElementById(imageId);
	setOpacity(image, 0);
	image.style.visibility = "visible";
	fadeIn(imageId,0);
}
function fadeIn(objId,opacity) {
	if (document.getElementById) {
		obj = document.getElementById(objId);
		if (opacity <= 100) {
			setOpacity(obj, opacity);
			opacity += 1;
			window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
		}
	}
}
function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99.999:opacity;
	// IE/Win
	obj.style.filter = "alpha(opacity:"+opacity+")";
	// Safari<1.2, Konqueror
	obj.style.KHTMLOpacity = opacity/100;
	// Older Mozilla and Firefox
	obj.style.MozOpacity = opacity/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	obj.style.opacity = opacity/100;
}

// window.onload = function(){initImage();} 


// SLIDE SHOW

var intval=""


var curimg=0
function rotateimages(){
document.getElementById("slideshow").setAttribute("src", galleryarray[curimg])
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0
}

// window.onload=function(){
// setInterval("rotateimages()", 2500)
// }

function startslides(){
intval=window.setInterval("rotateimages()",2500);
}


function stopslides(){
window.clearInterval(intval);
intval="";
}

// MOVIE

function PlayFlashMovie()
{
var ni = document.getElementById('myDiv');
var numi = 3
var num =  2;
numi.value = num;
var divIdName = "my"+num+"Div";
var newdiv = document.createElement('div');
var StockNo = "StockNo" + num;
var Descr = "Descr" + num;
var Price = "Price" + num;
var Msg = "Msg" + num;
var vt_stockno = "vt_stockno" + num;
var vt_descrip = "vt_descrip" + num;
var vt_price = "vt_price" + num;
newdiv.setAttribute("id",divIdName);
newdiv.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="320" height="240" id="simplemovie" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="http://67.42.244.214/video/GenFLVPlayer320240.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><param name="wmode" value="transparent" /><param name="flashvars" value="file=http://02a00ee.netsolhost.com/Video/eVG71406-902.flv" /><embed src="http://67.42.244.214/video/GenFLVPlayer320240.swf" name="simplemovie" wmode="transparent" flashvars="file=http://02a00ee.netsolhost.com/Video/eVG71406-902.flv" quality="high" width="320" height="240" align="middle" swliveconnect="true" allowScriptAccess="always" allowFullScreen="false" bgcolor="#ffffff" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
ni.appendChild(newdiv);
}

// FORM VALIDATION

<!--   0. CLEAR TEXT UPON ENTRY....................................-->
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
 
<!-- EIN FIELD.........................................-->
function vec_ein(toledo)
{
	Ctrl = toledo.vec_ein;
var err=0
if (Ctrl.value.length < 9 && Ctrl.value != "") err=1
if (err==1) {
		validatePrompt (Ctrl, "Please enter a valid Federal Identification Number.")
		return (false);
	}
	else
s = Ctrl.value;
filteredValues = ")(- ";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
	document.toledo.vec_ein.value = returnString;
		return (true);
}
 

<!-- COMPANY FIELD...........................................-->
function vec_company(toledo)
{
	Ctrl = toledo.vec_company;
	if (Ctrl.value == "")
	{
		validatePrompt (Ctrl, "Please enter full name.")
		return (false);
	}
	else
		return (true);
}





<!-- CONTACT FIELD...........................................-->
function vec_contact1(toledo)
{
	Ctrl = toledo.vec_contact1;
	if (Ctrl.value == "")
	{
		validatePrompt (Ctrl, "Please enter full name.")
		return (false);
	}
	else
		return (true);
}

<!--    3. ADDR1 FIELD.............................................-->
<!--    4. ADDR2 FIELD.............................................-->
<!--    5. CITY FIELD..............................................-->
function vec_city(toledo)
{
	Ctrl = toledo.vec_city;
	if (Ctrl.value == "")
	{
		validatePrompt (Ctrl, "Please enter your city.")
		return (false);
	}
	else
		return (true);
}


<!--    6  COUNTY FIELD............................................-->
<!--    7  STATE FIELD.............................................-->

<!--    8  ZIPCODE FIELD...........................................-->
function vec_zipcode(toledo)
{
   Ctrl = toledo.vec_zipcode;
   var temp_value = toledo.vec_zipcode.value; 
   if (Ctrl.value.length != 5 || Ctrl.value == "")
   {
   validatePrompt (Ctrl, "Please enter the correct zip code.")
   return (false);
   }

   if (Ctrl.value != "")
   {
   var Chars = "0123456789"; 
   for (var i = 0; i < temp_value.length; i++) 
   { 
       if (Chars.indexOf(temp_value.charAt(i)) == -1) 
       { 
           alert("Invalid Character(s)."); 
           return(false); 
       } 
	else 		return (true);

   }
   } 
}

<!--    9. WORK PHONE FIELD........................................-->
function vec_ofcphone(toledo)
{
Ctrl = toledo.vec_ofcphone;
var err=0
if (Ctrl.value.length < 10 && Ctrl.value != "") err=1
if (err==1) {
		validatePrompt (Ctrl, "Please enter a valid Phone Number with Area Code.")
		return (false);
	}
	else
s = Ctrl.value;
filteredValues = ")(- ";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
	document.toledo.vec_ofcphone.value = returnString;
		return (true);
}
 

<!--   10. FAX PHONE FIELD.........................................-->
function vec_faxphone(toledo)
{
	Ctrl = toledo.vec_faxphone;
var err=0
if (Ctrl.value.length < 10 && Ctrl.value != "") err=1
if (err==1) {
		validatePrompt (Ctrl, "Please enter a valid Phone Number with Area Code.")
		return (false);
	}
	else
s = Ctrl.value;
filteredValues = ")(- ";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
	document.toledo.vec_faxphone.value = returnString;
		return (true);
}
 

<!--   11. CELL PHONE FIELD........................................-->
function vec_celphone(toledo)
{
	Ctrl = toledo.vec_celphone;
var err=0
if (Ctrl.value.length < 10 && Ctrl.value != "") err=1
if (err==1) {
		validatePrompt (Ctrl, "Please enter a valid Phone Number with Area Code.")
		return (false);
	}
	else
s = Ctrl.value;
filteredValues = ")(- ";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
	document.toledo.vec_celphone.value = returnString;
		return (true);
}
 

<!-- HOME PHONE FIELD........................................-->
function vec_homphone(toledo)
{
	Ctrl = toledo.vec_homphone;
var err=0
if (Ctrl.value.length < 10 && Ctrl.value != "") err=1
if (err==1) {
		validatePrompt (Ctrl, "Please enter a valid Phone Number with Area Code.")
		return (false);
	}
	else
s = Ctrl.value;
filteredValues = ")(- ";     // Characters stripped out
var i;
var returnString = "";
for (i = 0; i < s.length; i++) {  // Search through string and append to unfiltered values to returnString.
var c = s.charAt(i);
if (filteredValues.indexOf(c) == -1) returnString += c;
}
	document.toledo.vec_homphone.value = returnString;
		return (true);
}
 
<!-- EMAIL FIELD. . . . . . . . . . . . . . . . . . .    -->
function vec_email(toledo)
{
	Ctrl = toledo.vec_email;
	if (Ctrl.value == "" || Ctrl.value.indexOf ('@', 0) == -1)
	{
		validatePrompt (Ctrl, "Please enter a valid e-mail address.")
		return (false);
	}
	else
if ((Ctrl.value.indexOf(".com")<5)&&(Ctrl.value.indexOf(".org")<5)
&&(Ctrl.value.indexOf(".gov")<5)&&(Ctrl.value.indexOf(".net")<5)
&&(Ctrl.value.indexOf(".biz")<5)&&(Ctrl.value.indexOf(".us")<4)
&&(Ctrl.value.indexOf(".mil")<5)&&(Ctrl.value.indexOf(".edu")<5)){
alert("Im sorry. This email address seems wrong. Please"
+" check the suffix for accuracy. (It should include a "
+".com, .edu, .net, .org, .gov or .mil)");
return false;
   }
		return (true);
}


<!--   12. TEXTAREA FIELDS.........................................-->

function checkLength(toledo){
    if (toledo.vec_narrate.value.length > 3995  || toledo.vec_memo1.value.length > 3995 || toledo.vec_protocol.value.length > 3995 || toledo.vec_attribs.value.length > 3995 || toledo.vec_remarks1.value.length > 3995){
        alert("Text too long. Must be 3995 characters or less");
        return false;
	}
	else
		return (true);
}

function x_Amount()
{
var TAmt = eval(document.toledo.x_Amount.value);
TAmt = TAmt.toString().replace(/\$|\,/g,'');
if(isNaN(TAmt))
TAmt = "0";
sign = (TAmt == (TAmt = Math.abs(TAmt)));
TAmt = Math.floor(TAmt*100+0.50000000001);
cents = TAmt%100;
TAmt = Math.floor(TAmt/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((TAmt.length-(1+i))/3); i++)
TAmt.substring(TAmt.length-(4*i+3));
document.toledo.x_Amount.value = (TAmt + '.' + cents);
		return (true);
}


function x_Card_Num(form)
{
	Ctrl = form.x_Card_Num;
	if (Ctrl.value == "")
	{
 
		validatePrompt (Ctrl, "Please enter a valid credit card number.")
		return (false);
	}
	else
		return (true);
}


function x_Card_Code(form)
{
	Ctrl = form. x_Card_Code;
	if (Ctrl.value == "")
	{
 
validatePrompt (Ctrl, " Please enter your Credit Card Verfication Number.\n\nYour Card Verification Number is the 3-digit number that\nis printed on the back of your card.\nFor your safety and security, we require that you enter\nyour credit card's verification number.")
		return (false);
	}
	else
		return (true);
}



function orderTotal(form)
{
  document.toledo.vt_survey2q.value = document.toledo.vt_survey1q.value * document.toledo.vt_survey1a.value
  document.toledo.vt_survey4q.value = document.toledo.vt_survey3q.value * document.toledo.vt_survey3a.value
  document.toledo.vt_survey6q.value = document.toledo.vt_survey5q.value * document.toledo.vt_survey5a.value
  document.toledo.vt_survey8q.value = document.toledo.vt_survey7q.value * document.toledo.vt_survey7a.value
  document.toledo.vt_survey10q.value = document.toledo.vt_survey9q.value * document.toledo.vt_survey9a.value
  document.toledo.vt_survey12q.value = document.toledo.vt_survey11q.value * document.toledo.vt_survey11a.value
  document.toledo.x_amount.value = ((document.toledo.vt_survey2q.value * 1) +
  (document.toledo.vt_survey4q.value * 1) +
  (document.toledo.vt_survey6q.value * 1) +
  (document.toledo.vt_survey8q.value * 1) +
  (document.toledo.vt_survey10q.value * 1) +
  (document.toledo.vt_survey12q.value * 1))
}

function remitTotal(form)
{
document.toledo.x_Amount.value = ((document.toledo.vt_price.value * document.toledo.vt_quantity.value) * 1)
}

function runSubmit(form ,button)
{
	if (!vt_contact1(form)) return;
	if (!vt_email(form)) return;
	if (!vt_addr1(form)) return;
	if (!vt_ofcphone (form)) return;
	if (!vt_city(form)) return;
	if (!vt_zipcode(form)) return;
alert("Thank you");
document.toledo.submit();
	return;
}
 
function validatePrompt (Ctrl, PromptStr)
{
	alert (PromptStr)
	Ctrl.focus();
	return;
}


