//filmStrip values you can override:
rightMoves = -5;
leftMoves = 5;



function delHover() 
{
imgTags = document.getElementsByTagName("img");
for (i=0; i<imgTags.length; i++) 
{
imgTags[i].title = "";
imgTags[i].alt = "";
}
}





function noClick()
{
if (window.AlbumID && (window.AlbumID == "4935937") )
removeLinkFromImg();
}


function removeLinkFromImg()
{
var links = document.getElementsByTagName("A");
for (var i = 0; i < links.length; i++)
{
var link = links[i];
var divElm = link.parentNode;
if (!divElm) continue;
divElm = divElm.parentNode;
if (!divElm) continue;
if (divElm.className.indexOf("photo")<0) continue;
link.href = "javascript:void(0);";
}
}





function redirectPath() { 
  re = /((www.)?crystalclear.smugmug.com)/; 
  tmp = window.location.href; 
  if (re.test(tmp)) { 
    tmp = tmp.replace(re, 'www.crystalclearphotos.com'); 
    window.location.href = tmp; 
  } 
}
redirectPath(); 

/***************************/
/* guestbook javascript    */
/***************************/

function ModifyText ()
{
  if (YD.hasClass(document.body, "gallery_1680280")) 
  {
    var objElement = YD.get("comment")
    if (objElement != null) 
    {
      var str = new String(objElement.innerHTML);
      str = str.replace(/\gallery/gi, 'Client');
      objElement.innerHTML = str;
    }
  }
}

YE.onAvailable("comment", ModifyText);



/***************************/
/* Menu Code               */
/***************************/

   var menuArray = new Array();
  var tableID   = null;
  var   rowID   = null;

  function collapse(subMenu)
  {
 // 	alert(menuArray.length);

    if(subMenu==0)
      {
    //CLOSE ALL OPEN SUB-MENUS IN REVERSE ORDER FROM WHICH THEY WERE OPENED
        for(var i=(menuArray.length)-1; i>=0; i--)
        {
          document.getElementById(menuArray[i]).style.display="none";
            menuArray.length=i;  //DELETES ROW[I] FROM THE ARRAY
        }
      }
    else
      {
      //CLOSE APPROPRIATE SUB-MENU CHILDREN
        var j=menuArray.length;
        while(menuArray[--j]!=subMenu)
      {
          document.getElementById(menuArray[j]).style.display="none";
          menuArray.length=j;
        }
      }
  }

  function checkTable(ID)
  {
  //USED FOR TROUBLESHOOTING
  //alert("rowID="+rowID+", tableID="+tableID+", ID="+ID+", mA[0]="+menuArray[0]+", mA[1]="+menuArray[1]+", mA[2]="+menuArray[2])

  //THE MENU OPTION SELECTED HAS NO SUB-MENUS, SO CLOSE ALL OPEN SUB-MENUS AND STOP PROCESSING
    if(rowID==0)
      {
        collapse(0);
        return;
    }

  //A MENU OPTION FROM A DIFFERENT TABLE (GROUPING) HAS BEEN SELECTED, SO CLOSE ALL SUB-MENUS FROM THE OTHER TABLE
    if(tableID!=ID)
      {
         tableID =ID;
       collapse(0);
      }

      var flag=0;
  //CHECK IF THE SUB-MENU HAS ALREADY BEEN OPENED
      for(var i=0; i<menuArray.length; i++)
      {
        if(menuArray[i]==rowID)
             flag=1;
      }

  //IF THE MENU SELECTED IS ALREADY OPEN
      if(flag==1)
      {
      //COLLAPSE ALL SUB-MENU CHILDREN
        collapse(rowID);
      }
      else
      {
      //DISPLAY THE SUB-MENU
      	if((rowID != null) && (rowID != "0") )
      	{
      		menuArray[menuArray.length] = rowID;
      		document.getElementById(rowID).style.display = "";
      		//objSpan = eval("document.getElementById('span"+rowID+"')");
     		 //objSpan.style.display = "block";
     	 }
      }
  }



/***************************/
/*Vanity URL’s             */
/***************************/

var vanityTable = 
 {
     aboutus: "http://www.crystalclearphotos.com/gallery/2557419_WttZN",
     contactus: "http://www.crystalclearphotos.com/gallery/4775586_nC3Cx",
     FAQ: "http://www.crystalclearphotos.com/gallery/1737601_2qrqi",
     guestbook: "http://www.crystalclearphotos.com/gallery/1680280_BMPhf",
     links: "http://www.crystalclearphotos.com/gallery/2052788",
     yourweddingday: "http://www.crystalclearphotos.com/gallery/1939757",
     gradcards: "http://www.crystalclearphotos.com/gallery/2580903",
     weddingpricing: "http://www.crystalclearphotos.com/gallery/2545739_surct",
     portraitpricing: "http://www.crystalclearphotos.com/gallery/2553695_dKbet",
     portraitpayments: "http://www.crystalclearphotos.com/gallery/4698321_M3CD5"
 }

function CheckRedirects()
 {
     if (YD.hasClass(document.body, 'homepage'))    // only run this code on the home page
     {
         // get the path from the current URL, 
         // convert it to lowercase and remove the leading slash
         var path = window.location.pathname.toLowerCase().substr(1);
         
         var newURL = vanityTable[path];        // look it up in our table
         
         // if we found it in the table && newURL is different than where we are
         if (newURL && (newURL != window.location))
         {
             window.location.replace(newURL);        // go to the new URL
         }
     }
 }



/* ****************************/
/* Gallery Contact Form Logic */
/* ****************************/


function GalleryFormCalc()
{
urlToImage =  webServer + "/gallery/" + AlbumID + "_" + AlbumKey;
document.GalleryForm.gallerylink.value= urlToImage;
}


function GalleryFormValidate()
{
	if (document.GalleryForm.eventname.value == "")
	{
		alert("The Event/Session Name is required");
		document.GalleryForm.eventname.focus();
		return false;

	}

       if (document.GalleryForm.customeremail.value == "")
	{
		alert("Your E-Mail Address is required");
		document.GalleryForm.customeremail.focus();
		return false;
	}
	

}


/* **************************/
/* Paypal Button Logic Main */
/* **************************/

function fixPhotoNav() {

  var oPhotoNav = YD.getElementsByClassName("photoNav", "div");



  for (var i=0; i < oPhotoNav.length; i++) {

    var re = /gallery\/([\d]+)(_(\w+))?\//;

    var oTitle = YD.getElementsByClassName("title", "span", oPhotoNav[i]);

    if (re.test(window.location)) {

      oTitle[0].innerHTML = "|&nbsp;" + oTitle[0].innerHTML + "&nbsp;|";

      re.exec(window.location);

      oPhotoNav[i].innerHTML = oPhotoNav[i].innerHTML + "<span ><a href='/gallery/" + RegExp.$1 + ((RegExp.$2 != undefined) ? RegExp.$2 : "") + "'>Return to Album</a></span>";

    }

  }

}




function setPaypalFormm(form) {


 urlToImage =  webServer + "/gallery/" + AlbumID + "_" + AlbumKey + "/1/" + ImageID + "_" + ImageKey + "/Small";


 form.item_number.value = "Image Link: " + urlToImage;

 

 if (document.PhotoOrderFormm.item_name.value == "Click the arrow for print/package list")

      {

        document.PhotoOrderFormm.item_name.value=printsarraym[1];

        }


 if (document.PhotoOrderFormm.os0.value == "Click the arrow for picture enhancement")

      {

        document.PhotoOrderFormm.os0.value=printsarraymt[1];

        }


 PhotoOrderFormmShowPrice();


}



function PhotoOrderFormmFormatValues(value)

{


 var temp = Math.round(value * 100);

 temp = temp / 100;

 return temp;


}


function PhotoOrderFormmShowPrice()



{


if (document.PhotoOrderFormm.business.value != "info@crystalclearphotos.com")


        {

        document.PhotoOrderFormm.business.value='info@crystalclearphotos.com'


        }

   document.PhotoOrderFormm.amount.value= PhotoOrderFormmFormatValues(parseFloat(printspricearraym[document.PhotoOrderFormm.item_name.selectedIndex]));

   document.PhotoOrderFormm.paypalfilename.value=mainPhotoFileName;

   document.PhotoOrderFormm.os1.value= mainPhotoFileName + "; Notes: " + document.PhotoOrderFormm.instruct.value; 

   


}


var printsarraym = new Array();
var printspricearraym = new Array();
var printsarraymt = new Array();



/*****************************************************************************/
/* NOTE: ANY CHANGES TO THE VALUES BELOW, YOU MUST SAVE THEN CLOSE YOUR      */
/* BROWSER. RE-OPEN YOUR BROWSER AND ACCESS YOUR SITE - THE NEW VALUES WILL  */
/* APPEAR.                                                                   */
/*****************************************************************************/

/*****************************************************************************/
/* MODIFYING ITEMS AND PRICES                                                */
/*                                                                           */
/* The items for prints as well as packages are stored in the arrays below   */
/* Each item has a description (first column) and a price (second column)    */
/* To add more items: 			                                     */
/* -Copy the last row within the array                                        */
/* -Paste the row at the end of the array                                    */
/* "printsarraym[10]="....."; printspricearraym[10]=".....";"                */
/* -Change the number to the next sequential number                          */
/* -Change the value within the ""                                           */
/*                                                                           */
/* To change an item name or price:                                          */
/* -Change the value within the ""                                           */
/*                                                                           */
/* To delete an item:                                         		     */
/* -Highlight the row you wish to delete                                     */
/* -Press the delete or backspace key                                        */
/* -Remove the empty row by pressing the delete or backspace key             */
/* -Important - renumber the array    in numerical order                     */
/*                                                                           */
/*                                                                           */
/*                                                                           */
/*****************************************************************************/




/******************/
/* Main Item List */
/******************/

printsarraym[0]="Click the arrow for print/package list"; 	printspricearraym[0]="0.00";
printsarraym[1]="8 Wallets ($ 14.00)";      	printspricearraym[1]="14.00";
printsarraym[2]="4x6 ($ 4.50)";      	printspricearraym[2]="4.50";
printsarraym[3]="5x7 ($ 9.00)";		printspricearraym[3]="9.00";
printsarraym[4]="8x10 ($ 15.00)";		printspricearraym[4]="15.00";
printsarraym[5]="11x14 ($ 35.00)";		printspricearraym[5]="35.00";
printsarraym[6]="16x20 ($ 75.00)";		printspricearraym[6]="75.00";
printsarraym[7]="Family Package (1 8x10, 2 5x7's, & 8 Wallets) ($40.00)";		printspricearraym[7]="40.00";
printsarraym[8]="Deluxe Package (2 8x10's, 4 5x7's, & 24 Wallets) ($75.00)";		printspricearraym[8]="75.00";
printsarraym[9]="Senior Package (2 8x10's, 4 5x7's, & 48 Wallets) ($95.00)";		printspricearraym[9]="95.00";
printsarraym[10]="24 Wallets ($ 25.00)";		printspricearraym[10]="25.00";
printsarraym[11]="48 Wallets ($ 45.00)";		printspricearraym[11]="45.00";
printsarraym[12]="Classic Photo Cards (25 4x6 cards with envelopes) ($ 40.00)";		printspricearraym[12]="40.00";
printsarraym[13]="Slimeline Photo Cards (25  4x8 cards with envelopes) ($ 45.00)";		printspricearraym[13]="45.00";
printsarraym[14]="Designer Photo Cards (25 5x7 cards with envelopes) ($ 50.00)";		printspricearraym[14]="50.00";
printsarraym[15]="10x10 Composite (Matted & Framed) ($ 100.00)";		printspricearraym[15]="100.00";
printsarraym[16]="11x14 Gallery Wrap Canvas ($ 125.00)";
        printspricearraym[16]="125.00";
printsarraym[17]="11x14 Framed Canvas Print ($ 150.00)";
        printspricearraym[17]="150.00";
printsarraym[18]="12x12 Composite (Matted & Framed) ($ 125.00)";
        printspricearraym[18]="125.00";
printsarraym[19]="10x20 Storyboard (Matted & Framed) ($ 145.00)";
        printspricearraym[19]="145.00";
printsarraym[20]="16x20 Storyboard (Matted & Framed) ($ 195.00)";
        printspricearraym[20]="195.00";

printsarraymt[0]="Click the arrow for picture enhancement"; 	
printsarraymt[1]="Color";        
printsarraymt[2]="Black and White";        
printsarraymt[3]="Watercolor";      
printsarraymt[4]="Vintage"; 
printsarraymt[5]="Sepia"; 
printsarraymt[6]="Chocolate"; 
printsarraymt[7]="Midnight Blue - Color Tint"; 
printsarraymt[8]="Soft Focused"; 
printsarraymt[9]="Edge Softening Vignette"; 


function PhotoOrderFormPopulatem()
{

   for (i=0; i<printsarraym.length; i++)
   {
        document.PhotoOrderFormm.item_name.options[i]=new Option(printsarraym[i], printsarraym[i])
       
   }

   
}


function PhotoOrderFormPopulatemt()
{

   for (j=0; j<printsarraymt.length; j++)
   {
        document.PhotoOrderFormm.os0.options[j]=new Option(printsarraymt[j], printsarraymt[j])
       
   }

   
}


