var textArray=new Array(15);
for (var i = 0; i < textArray.length; i++) {
  textArray[i]=" ";
}

var globalInt = 0;
///////////



function iepostUrl (mywindow, actionURL) {
msg='<big><strong>DoggTagz.com<br>Loading Shopping Cart...<br>Please wait!</strong><big>'
document.write(msg);
mywindow.document.write();
goUrl = "http://www.ccnow.com/cgi-local/cart.cgi?148500157_shopcart_"
+ actionURL;
eval('location.href=goUrl');
eval('location.replace(goUrl)');
}
/////////////


function postProd (actionURL, prodcode) {
 
if (navigator.appName.indexOf('Netscape') >= 0) {

	urlprodcode=prodcode;
	url="http://www.ccnow.com/cgi-local/cart.cgi?148500157_" + prodcode
		+ "_" + actionURL;
	eval('location.href=url');
	eval('location.replace(url)');
	return;
	}
	msg='<br><br><br><br><br><center><big><big><strong><big>DoggTagz.com</big><br><br>Loading Shopping Cart...<br>Please wait!</strong></big></big></center>'
 	document.write(msg); 
	urlprodcode=prodcode;
	url="http://www.ccnow.com/cgi-local/cart.cgi?148500157_" + prodcode
		+ "_" + actionURL;
	eval('location.href=url');
	eval('location.replace(url)');
}
/////////////


function right(e) {
  var msg = "DoggTagz.com dog tags are cool!";

  if (navigator.appName == 'Netscape' && e.which == 3) {
   alert(msg);
   return false;
  }

  if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
   alert(msg);
   return false;
  }
  else return true;
}
///////
function trap() {
  if(document.images)
 
  for(i=0;i<document.images.length;i++) {
   document.images[i].onmousedown = right;
   document.images[i].onmouseup = right;
  }
}


////////





function showFormInWindow () {

setCookie();

if (document.getElementById("firstname").value.length < 1) {
  alert("Please enter Contact Information: First Name");
  document.getElementById("firstname").focus();
  return false;
}
if (document.getElementById("lastname").value.length < 1) {
  alert("Please enter Contact Information: Last Name");
  document.getElementById("lastname").focus();
  return false;
}
if (document.getElementById("email_address").value.length < 1) {
  alert("Please enter Contact Information: Email Address");
  document.getElementById("email_address").focus();
  return false;
}

if ((document.getElementById("line1input").value.length < 1) &&
   (document.getElementById("line2input").value.length < 1) &&
   (document.getElementById("line3input").value.length < 1) &&	
   (document.getElementById("line4input").value.length < 1) &&
   (document.getElementById("line5input").value.length < 1)) {
	  
  	alert("Please enter Tag Line Info!");
	document.getElementById("line1input").focus();
  	return false;
   
} 


document.getElementById("line1input").value = document.getElementById("line1input").value.toUpperCase();
document.getElementById("line2input").value = document.getElementById("line2input").value.toUpperCase();
document.getElementById("line3input").value = document.getElementById("line3input").value.toUpperCase();
document.getElementById("line4input").value = document.getElementById("line4input").value.toUpperCase();
document.getElementById("line5input").value = document.getElementById("line5input").value.toUpperCase();

confirmMsg = "Are you ready to submit your dog tag info and proceed to the shopping cart?";

modelMsg = "Model Nbr: " + document.getElementById("modelnbr").value + " - " + document.getElementById("modeldesc").value;
priceMsg = "";

if (document.getElementById("modelnbr").value == "MIL001A"){
	priceMsg="Price: $4.99 ea., 2+ $4.49 ea., 5+ $4.25 ea.";
}

if (document.getElementById("modelnbr").value == "MIL001"){
	priceMsg="Price: $4.99 ea.";
}
if (document.getElementById("modelnbr").value == "MIL001S"){
	priceMsg="Price: $5.49 ea.";
}
if (document.getElementById("modelnbr").value == "MIL002"){
	priceMsg="Price: $8.99 per pair.";
}
if (document.getElementById("modelnbr").value == "MIL002S"){
	priceMsg="Price: $9.99 per pair.";
}
if (document.getElementById("modelnbr").value == "MIL005"){
	priceMsg="Price: $21.25 per set.";
}
if (document.getElementById("modelnbr").value == "MIL005S"){
	priceMsg="Price: $23.75 per set.";
}

line1msg = "Line 1: " + document.getElementById("line1input").value;
line2msg = "Line 2: " + document.getElementById("line2input").value;
line3msg = "Line 3: " + document.getElementById("line3input").value;
line4msg = "Line 4: " + document.getElementById("line4input").value;
line5msg = "Line 5: " + document.getElementById("line5input").value;

chain27Msg="";
chain55Msg="";
keyringMsg="";
chainMsg="";
chainAllMsg="";

if (document.getElementById("modelnbr").value == "MIL001"){
	document.getElementById("silencercolor").value = "None";
}
if (document.getElementById("modelnbr").value == "MIL002"){
	document.getElementById("silencercolor").value = "None";
}
if (document.getElementById("modelnbr").value == "MIL005"){
	document.getElementById("silencercolor").value = "None";
}

silencerMsg="";
silencerMsg = "Silencer color: " + document.getElementById("silencercolor").value;

emailMsg="";
if (document.getElementById("confirm").checked){
  emailMsg ="Send confirmation e-mail to: " + document.getElementById("email_address").value;
}

speicalOrigMsg="Type in special instructions here. eg. Use one of the special characters listed above, etc.";
specialMsg="Special Instructions: " + document.getElementById("special_instructions").value;
if (document.getElementById("special_instructions").value == speicalOrigMsg){
	specialMsg="";
}


showMsg = confirmMsg+"\n"+"\n"+modelMsg+"\n"+"\n"+priceMsg+"\n"+"\n"+line1msg+"\n"+line2msg+"\n"+line3msg+"\n"+line4msg+"\n"+line5msg+"\n"+"\n"+silencerMsg+"\n"+"\n"+specialMsg+"\n"+"\n"+emailMsg;
if (confirm (showMsg)) {
   rval = false;
   rval = doFinal();
   return rval;
}

return false;

/* the code below only works for internet explorer */
/* window.returnValue = showModalDialog('whatup_3.htm',form1,'dialogHeight:700px;status:no;resizable:yes');  */

/* return window.returnValue; */

} /*--end check tag line info --*/

/////
function doFinal (){

lString = " ";
mString = " ";
lString = document.getElementById("line1input").value;
mString = lString.replace(/ /gi, "b");
document.getElementById("L1").value = mString;

lString = " ";
mString = " ";
lString = document.getElementById("line2input").value;
mString = lString.replace(/ /gi, "b");
document.getElementById("L2").value = mString;

lString = " ";
mString = " ";
lString = document.getElementById("line3input").value;
mString = lString.replace(/ /gi, "b");
document.getElementById("L3").value = mString;

lString = " ";
mString = " ";
lString = document.getElementById("line4input").value;
mString = lString.replace(/ /gi, "b");
document.getElementById("L4").value = mString;

lString = " ";
mString = " ";
lString = document.getElementById("line5input").value;
mString = lString.replace(/ /gi, "b");
document.getElementById("L5").value = mString;

lString = " ";
lString = document.getElementById("lastname").value;
mString = "Dog Tag Input Form: " + lString;
document.getElementById("subject").value = mString + " " + globalInt;

return true;
}



function nextUrl(this_button,nextUrl) {

	if (this_button.name == "military_tag"){
    		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL001A_http://doggtagz.com/military_dog_tags.htm';
  			document.getElementById("modelnbr").value="MIL001A";
  			document.getElementById("modeldesc").value="Steel military dog tag(s) with chain(s).";
  			document.getElementById("quantity").value="ONE";
  		
	}

	if (this_button.name == "single_tag"){
    		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL001_http://doggtagz.com/military_dog_tags.htm';
  			document.getElementById("modelnbr").value="MIL001";
  			document.getElementById("modeldesc").value="Single tag with one chain/key ring.";
  			document.getElementById("quantity").value="ONE";
  		
	}
	
	if (this_button.name == "single_tag_s"){
    		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL001S_http://doggtagz.com/military_dog_tags.htm';
  			document.getElementById("modelnbr").value="MIL001S";
  			document.getElementById("modeldesc").value="Single tag with one silencer and one chain/key ring.";
  			document.getElementById("quantity").value="ONE";
  		
	}
	if (this_button.name == "five_pack"){
		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL005_http://doggtagz.com/military_dog_tags.htm';
		document.getElementById("modelnbr").value="MIL005";
		document.getElementById("modeldesc").value="Five tags with five chains/key rings.";
		document.getElementById("quantity").value="FIVE";	
			
	}
 	if (this_button.name == "five_pack_s"){
		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL005S_http://doggtagz.com/military_dog_tags.htm';
		document.getElementById("modelnbr").value="MIL005S";
		document.getElementById("modeldesc").value="Five tags with five silencers and five chains/key rings.";
		document.getElementById("quantity").value="FIVE";	
			
	}
	if (this_button.name == "tag_pair"){
    		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL002_http://doggtagz.com/military_dog_tags.htm';
    		document.getElementById("modelnbr").value="MIL002";
    		document.getElementById("modeldesc").value="Two tags with two chains/key rings.";
    		document.getElementById("quantity").value="TWO";
    		
	}
	if (this_button.name == "tag_pair_s"){
    		document.getElementById("next_url").value='http://www.ccnow.com/cgi-local/cart.cgi?148500157_MIL002S_http://doggtagz.com/military_dog_tags.htm';
    		document.getElementById("modelnbr").value="MIL002S";
    		document.getElementById("modeldesc").value="Two tags with two silencers and two chains/key rings.";
    		document.getElementById("quantity").value="TWO";
    		
	}
document.getElementById("navigator").value=navigator.appName;
document.getElementById("clickdate").value= new Date();
document.getElementById("version").value=navigator.appVersion;
document.getElementById("platform").value=navigator.platform;
document.getElementById("agent").value=navigator.userAgent;



return false;

}




function loadImages() {




 var isNav, isNav4, isIE4;
 
 if (navigator.appVersion.charAt(0) <= "4") {
	if (navigator.appName == "Netscape") {
	  isNav4 = true;
	} else if (navigator.appVersion.indexOf("MSIE") != -1) {
	  isIE4 = true;
	}
 }
	
var imageArray = new Array();

imageArray[0] = 'dog_tag_preview.jpg';
imageArray[1] = 'dog_tag_preview_clear.jpg';
imageArray[2] = 'dog_tag_preview_bl.jpg';
imageArray[3] = 'dog_tag_preview_blue.jpg';
imageArray[4] = 'dog_tag_preview_gn.jpg';
imageArray[5] = 'dog_tag_preview_or.jpg';
imageArray[6] = 'dog_tag_preview_pnk.jpg';
imageArray[7] = 'dog_tag_preview_red.jpg';
imageArray[8] = 'dog_tag_preview_purp.jpg';
imageArray[9] = 'dog_tag_preview_yl.jpg';

  for (var i = 0; i < 10; i++) {
    var docimage=new Image();
    docimage.src = imageArray[i];
  }
 
clearTag();
}

function switchColor(thisRadio, thisDiv) {
	
    if (thisRadio.value == "None") {
      document.getElementById("preview").src="dog_tag_preview.jpg";
      return true;
    }   
    if (thisRadio.value == "Clear") {
      
       document.getElementById("preview").src="dog_tag_preview_clear.jpg";
	return true;
    } 
    if (thisRadio.value == "Black") {
         document.getElementById("preview").src="dog_tag_preview_bl.jpg";
	return true;
    } 
    if (thisRadio.value == "Blue") {
       document.getElementById("preview").src="dog_tag_preview_blue.jpg";
	return true;
    } 
    if (thisRadio.value == "Green") {
      document.getElementById("preview").src="dog_tag_preview_gn.jpg";
	return true;
    } 
    if (thisRadio.value == "Orange") {
      document.getElementById("preview").src="dog_tag_preview_or.jpg";
       	return true;
    } 
    if (thisRadio.value == "Pink") {
      document.getElementById("preview").src="dog_tag_preview_pnk.jpg";
	return true;
    } 
    if (thisRadio.value == "Red") {
      document.getElementById("preview").src="dog_tag_preview_red.jpg";
	return true;
    } 
    if (thisRadio.value == "Purple") {
      document.getElementById("preview").src="dog_tag_preview_purp.jpg";
	return true;
    } 
    if (thisRadio.value == "Yellow") {
      document.getElementById("preview").src="dog_tag_preview_yl.jpg";
	return true;
    
    } 
 	

 
}


function fillline(thisText, thisTagLine) {

for (var i = 0; i < textArray.length; i++) {
  textArray[i]=" ";
}
var goodval=false;
var showit=false;

var htmlstring='';

var aHtmlHide="<span style='visibility:hidden;font-size:09pt;font-family:monospace;font-weight:300;text-align:left;letter-spacing:.12mm;color:gray;'><tt>";
var aHtmlShow="<span style='visibility:visible;font-family:monospace;font-size:09pt;font-weight:300;text-align:left;letter-spacing:.12mm;color:gray;'><tt>";
var bHtml="</tt></span>";


 for (var i = 0; i < thisText.value.length; i++) {
	textArray[i]=' ';
	if (isNaN(thisText.value.charCodeAt(i))){
		return;
	}
 	goodval = isValid(thisText.value.charAt(i).toUpperCase());
	
	if (!goodval) {
	   document.getElementById("errormsg").innerHTML="INVALID CHARACTER: ".bold().fontcolor("red") + "(".bold().fontcolor("red") + thisText.value.charAt(i) + ")".bold().fontcolor("red");
	    thisText.value=thisText.value.substr(0, thisText.value.length-1);
	   break;
	} else {
	 
	  document.getElementById("errormsg").innerHTML="Good so far!";
 	}

 }
 
for (var i = 0; i < thisText.value.length; i++) {
 
   if (thisText.value.charAt(i)==" ") {
	htmlstring=htmlstring+aHtmlHide + "a" + bHtml;

  } else {
	htmlstring=htmlstring+aHtmlShow + thisText.value.charAt(i).toUpperCase() + bHtml;

  }
	 
}

thisTagLine.innerHTML=htmlstring;


}/*!-- end filline function --*/


function clearTag() {
 
document.getElementById("tag1line1").innerHTML=" ";
document.getElementById("tag1line2").innerHTML=" ";
document.getElementById("tag1line3").innerHTML=" ";
document.getElementById("tag1line4").innerHTML=" ";
document.getElementById("tag1line5").innerHTML=" ";
  
document.getElementById("errormsg").innerHTML=" ";
var form1=document.getElementById("form1")
var tag1=document.getElementById("tag1")
document.getElementById("silencercolor").selected="none";
switchColor(form1.silencercolor, tag1);
return true;
}

function isValid (myChar) {

goodChar = "\"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 &'.-,/()=";

 for (var i = 0; i < goodChar.length; i++) {

	if (myChar == goodChar.charAt(i)){
		return true;
	}
 }

return false;
}


function modalessDialog() {



window.name="FREDDYKRUGER";
var fred;


fred=false;
fred=window.open('whatup_3.htm', 'win2', 'scrollbars=yes,status=yes,location=no,resizable=yes,width=500,height=650 top=-5 left=370');

return false;


}

