// Application type
function ProdType(op) {

  if (op == "-1") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 8.1") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 8.0.4") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 8.0.3") {
    document.email.program.value="apac_iphoto";
  }
   if (op == "iPhoto 8.0.2") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 8.0.1") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 8.0") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 7.x") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "iPhoto 6.x") {
    document.email.program.value="apac_iphoto";
  }
  if (op == "Aperture 2.1.4") {
	document.email.program.value="apac_aperture";
  }
  if (op == "Aperture 2.1.3") {
	document.email.program.value="apac_aperture";
  }
  if (op == "Aperture 2.1.2") {
	document.email.program.value="apac_aperture";
  }
  if (op == "Aperture 2.1.1") {
	document.email.program.value="apac_aperture";
  }
  if (op == "Aperture 2.1") {
	document.email.program.value="apac_aperture";
  }
  if (op == "Aperture 2.0") {
	document.email.program.value="apac_aperture";
  }
}
// end Application Type

// Subject1 (Topic) / Category (Sub-topic) / Details drop-down
var subject1 = "";

function changetext(Dropdown_Val, Dropdown_Val_SI)
{
	if(subject1.value == "Managing and Editing My Account") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_account1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_account2;
			break
			case 3:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_account3;
			break
			case 4:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_account4;
			break
	
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "I'm Having Problems Placing My Order") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_place1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_place2;
			break
			case 3:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_place3;
			break
			
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "I Want to Change or Cancel My Order") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_cancel1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_cancel2;
			break
			
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "I Haven't Received My Order Yet") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd2;
			break
			case 3:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd3;
			break
			case 4:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd4;
			break
			case 5:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd5;
			break
			case 6:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_rcvd6;
			break
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "There's a Problem With an Order I Received") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob2;
			break
			case 3:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob3;
			break
			case 4:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob4;
			break
			case 5:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob5;
			break
			case 6:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob6;
			break
			case 7:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob7;
			break
			case 8:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob8;
			break
			case 9:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_prob9;
			break
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "I Have Questions About Billing") {
		switch (Dropdown_Val_SI)
		{
			case 1:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill1;
			break
			case 2:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill2;
			break
			case 3:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill3;
			break
			case 4:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill4;
			break
			case 5:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill5;
			break
			case 6:
			document.email.alt_body.value=document.email.alt_body.value+photoserv_bill6;
			break
	
			default :
			document.email.alt_body.value="";
			break
		}
	}
	else if(subject1.value == "Other") {
		switch (Dropdown_Val_SI)
		{
			
			default :
			document.email.alt_body.value=document.email.alt_body.value+photoserv_other1;
			break
		}
	}
}

 
var arrItems2 = new Array();
var arrItemsGrp2 = new Array();


arrItems2[0] = photoserv_account11;
arrItemsGrp2[0] = "Managing and Editing My Account";
arrItems2[1] = photoserv_account12;
arrItemsGrp2[1] = "Managing and Editing My Account";
arrItems2[2] = photoserv_account13;
arrItemsGrp2[2] = "Managing and Editing My Account";
arrItems2[3] = photoserv_account14;
arrItemsGrp2[3] = "Managing and Editing My Account";

arrItems2[4] = photoserv_place11;
arrItemsGrp2[4] = "I'm Having Problems Placing My Order";
arrItems2[5] = photoserv_place12;
arrItemsGrp2[5] = "I'm Having Problems Placing My Order";
arrItems2[6] = photoserv_place13;
arrItemsGrp2[6] = "I'm Having Problems Placing My Order";

arrItems2[7] = photoserv_cancel11;
arrItemsGrp2[7] = "I Want to Change or Cancel My Order";
arrItems2[8] = photoserv_cancel12;
arrItemsGrp2[8] = "I Want to Change or Cancel My Order";

arrItems2[9] = photoserv_rcvd11;
arrItemsGrp2[9] = "I Haven't Received My Order Yet";
arrItems2[10] = photoserv_rcvd12;
arrItemsGrp2[10] = "I Haven't Received My Order Yet";
arrItems2[11] = photoserv_rcvd13;
arrItemsGrp2[11] = "I Haven't Received My Order Yet";
arrItems2[12] = photoserv_rcvd14;
arrItemsGrp2[12] = "I Haven't Received My Order Yet";
arrItems2[13] = photoserv_rcvd15;
arrItemsGrp2[13] = "I Haven't Received My Order Yet";
arrItems2[14] = photoserv_rcvd16;
arrItemsGrp2[14] = "I Haven't Received My Order Yet";

arrItems2[15] = photoserv_prob11;
arrItemsGrp2[15] = "There's a Problem With an Order I Received";
arrItems2[16] = photoserv_prob12;
arrItemsGrp2[16] = "There's a Problem With an Order I Received";
arrItems2[17] = photoserv_prob13;
arrItemsGrp2[17] = "There's a Problem With an Order I Received";
arrItems2[18] = photoserv_prob14;
arrItemsGrp2[18] = "There's a Problem With an Order I Received";
arrItems2[19] = photoserv_prob15;
arrItemsGrp2[19] = "There's a Problem With an Order I Received";
arrItems2[20] = photoserv_prob16;
arrItemsGrp2[20] = "There's a Problem With an Order I Received";
arrItems2[21] = photoserv_prob17;
arrItemsGrp2[21] = "There's a Problem With an Order I Received";
arrItems2[22] = photoserv_prob18;
arrItemsGrp2[22] = "There's a Problem With an Order I Received";
arrItems2[23] = photoserv_prob19;
arrItemsGrp2[23] = "There's a Problem With an Order I Received";

arrItems2[24] = photoserv_bill11;
arrItemsGrp2[24] = "I Have Questions About Billing";
arrItems2[25] = photoserv_bill12;
arrItemsGrp2[25] = "I Have Questions About Billing";
arrItems2[26] = photoserv_bill13;
arrItemsGrp2[26] = "I Have Questions About Billing";
arrItems2[27] = photoserv_bill14;
arrItemsGrp2[27] = "I Have Questions About Billing";
arrItems2[28] = photoserv_bill15;
arrItemsGrp2[28] = "I Have Questions About Billing";
arrItems2[29] = photoserv_bill16;
arrItemsGrp2[29] = "I Have Questions About Billing";

arrItems2[30] = photoserv_other11;
arrItemsGrp2[30] = "Other";


function selectChange(control, controlToPopulate, ItemArray, GroupArray) {
//alert("control=" + control);
subject1 = control;
  var myEle ;
  var x ;
  // Empty the second drop down box of any choices
  for (var q=controlToPopulate.options.length;q>=0;q--)
  controlToPopulate.options[q]=null;
  myEle=document.createElement("option");
  theText=document.createTextNode(functions_choose_subtopic);
  myEle.appendChild(theText);
  myEle.setAttribute("value","");
  controlToPopulate.appendChild(myEle);
  // Now loop through the array of individual items
  // Any containing the same child id are added to
  // the second dropdown box
  for ( x = 0 ; x < ItemArray.length  ; x++ ) {
    if ( GroupArray[x] == control.value ) {
      myEle = document.createElement("option") ;
      //myEle.value = x ;
      myEle.setAttribute("value",ItemArray[x]);
      // myEle.text = ItemArray[x] ;
      var txt = document.createTextNode(ItemArray[x]);
      myEle.appendChild(txt)
      // controlToPopulate.add(myEle) ;
      controlToPopulate.appendChild(myEle)
    }
  }
}
// end Subject1 (Topic) / Category (Sub-topic) / Details


// Show / hide sub-menu for product type
var divs = {
'Choose' : 'ChooseDIV' ,
'Books' : 'BooksDIV' ,
'Cards' : 'CardsDIV' ,
'Calendars' : 'CalendarsDIV' ,
'Prints' : 'PrintsDIV' ,
'Question' : 'QuestionDIV'
}

function showhide(obj)
{
var el, v = obj.options[obj.selectedIndex].value;
for (var opt in divs)
if (el = document.getElementById(divs[opt]))
el.style.display = (opt != v) ? 'none' : 'block';
}

window.onload = function()
{
document.getElementById('prod_type').onchange();
}

// First name / last name email function
function checkLogin(val) {
   if (document.cookie.indexOf("ACID=") == -1){
      return '';
   }
   var dc = document.cookie;
   var begin = dc.indexOf("ACID=") + 5;
	var len = dc.length;
   var end   = dc.indexOf(";", begin);
	if (end == -1) { end = dc.length; }
   if (val) {
      var str = unescape(dc.substring(begin,end));
      var array = str.split("~");
      var str = unescape(dc.substring(begin,end));
      var array = str.split("~");
      if (val == 'email') {return array[1]; }
      if (val == 'fname') {return array[2]; }
      if (val == 'lname') {return array[3]; }
		if (val == 'fullname') {return  array[2] + " " + array[3]; }
   }
   return unescape(dc.substring(begin,end));
}

function fname()    { document.write(checkLogin('fname')); }
function lname()    { document.write(checkLogin('lname')); }
function email()    { document.write(checkLogin('email')); }
function fullname() { document.write(checkLogin('fullname')); }
// end Show / hide sub-menu for product type


// elements in the form are numbered from the top 0 to ......
// The select option value specifies the element numbers to disable separated by '^'
function Select(f,s){
el=f.elements;
for (i=0;i<el.length;i++){
// el[i].style.visibility='visible';
el[i].removeAttribute('disabled');
}
if (s.selectedIndex<1){ return; }
selop=s.options[s.selectedIndex].value.split('^');
for (i=0;i<selop.length;i++){
if (el[selop[i]]){
// el[selop[i]].style.visibility='hidden';
el[selop[i]].setAttribute('disabled','disabled');
}
}
}

