
/***********************************************
* DHTML slideshow script-  © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

/* This script has been modified to suit the needs of this web site.  Visit the site above for the latest source code. */
var which=0

var linkornot=0
for(var lnk in photoslink){
if(!lnk) lnk = ""
if(lnk.length > 0){ linkornot=1 }
}

/* Don't invoke these insertXXX() functions more than once per document */
function insertImage(){
if (linkornot==1) {document.write('<a href="'+ photoslink[0] +'">') }
document.write('<img src="'+photos[0]+'" id="photoslider" alt="Loading image..." style="filter:revealTrans(duration=2,transition=23);border-style:none;" >')
if (linkornot==1) {document.write('</a>')}
}

function insertBlurb(){
document.write('<span id="blurb">'+ blurbs[0] +'</span>')
}

function insertForm(){
  //document.write('<div id="forms1" class="form1">');
  document.write(getFormHtml(0));
  //document.write('</div>');
}

function getFormHtml(index) {
formHtml = new String('');

for(i=0; i < forms[index].length; i++)
{
currentForm=forms[index][i];
backgroundColor = "#FFFFFF";
if(currentForm.backgroundColor) { backgroundColor = currentForm.backgroundColor}
formHtml = formHtml.concat(
           '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0px 0px 0px 0px">'
         + '<table style="width:100%;border: thin solid #BBAACE;background-color: ' + backgroundColor + '">'
         + '<tr>'
		 + '<td colspan="5">' + currentForm.itemName + '</td></tr>' 
		 + '<tr><td style="width:25%;text-align:right"><input type="hidden" name="on0" value="' + currentForm.optionLabel + '">' + currentForm.optionLabel + ':&nbsp;</td>'
         +  '<td>&nbsp;<select name="os0">' );
for(j=0; j < currentForm.options.length; j++)
{
  formHtml = formHtml.concat('<option value="' + currentForm.options[j] + '">' + currentForm.options[j] + '</option>');
}
formHtml = formHtml.concat('</select></td><td style="width:25%;text-align:right">');
if(currentForm.option2Label != null)
{
  formHtml = formHtml.concat('<input type="hidden" name="on1" value="' + currentForm.option2Label + '">' + currentForm.option2Label + ':&nbsp;</td>');
}
formHtml = formHtml.concat('<td>');
if(currentForm.option2Label != null)
{
  formHtml = formHtml.concat('&nbsp;<select name="os1">');
  for(j=0; j < currentForm.options2.length; j++)
  {
    formHtml = formHtml.concat('<option value="' + currentForm.options2[j] + '">' + currentForm.options2[j] + '</option>');
  }
  formHtml = formHtml.concat('</select>');
}
formHtml = formHtml.concat('</td><td style="text-align:right">'
		 + '<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it&acute;s fast, free and secure!">'
		 + '</td>'
         + '<input type="hidden" name="add" value="1">'
         + '<input type="hidden" name="cmd" value="_cart">'
         + '<input type="hidden" name="business" value="barbara@veilartistry.com">'
         + '<input type="hidden" name="item_name" value="' +currentForm.itemName + '">'
         + '<input type="hidden" name="item_number" value="' + currentForm.itemNumber + '">'
         + '<input type="hidden" name="amount" value="' + currentForm.amount + '">'
         + '<input type="hidden" name="no_shipping" value="' + currentForm.shipping + '">'
		 + '<input type="hidden" name="return" value="http://www.veilartistry.com/success.html">'
		 + '<input type="hidden" name="cancel_return" value="http://www.veilartistry.com/cancel.html">'
		 + '<input type="hidden" name="cn" value="Please Enter Wedding Date">'
         + '<input type="hidden" name="currency_code" value="USD">'
         + '<input type="hidden" name="lc" value="US">'
         + '</tr></table></form>' );
}
formHtml = formHtml.concat('<br/><table style="width:100%" border="0" cellspacing="0" cellpadding="0" >'
		+ '<tr>'
		+ '<td style="width:50%"></td>'
		+ '<td align="right">	'
		+ '<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">'
+ '<input type="hidden" name="cmd" value="_cart">'
+ '<input type="hidden" name="business" value="barbara@veilartistry.com">'
+ '<input type="image" src="https://www.paypal.com/en_US/i/btn/view_cart_02.gif" border="0" name="submit" alt="Make payments with PayPal - it&apos;s fast, free and secure!">'
+ '<input type="hidden" name="display" value="1">'
+ '</form>'
        + '</td>'		
		+ '</tr>'
		+ '</table>'
			+ '<iframe style="width:100%" src="trailer.html" scrolling="no" frameborder="0">This browser does not support iframe tags.</iframe>');


return formHtml;
}

function insertPreviousCtl(){
    document.write('<a id="previousControl" href="#" onClick="backward();return false"> </a>')
}
function insertNextCtl(){
    document.write('<a id="nextControl" href="#" onClick="forward();return false">')
    if(photos.length > 1) document.write(nextLink)
    document.write('</a>')
}

function applyeffect(){
var p = document.getElementById('photoslider')
if(p && p.filters){ 
p.filters.revealTrans.Transition=Math.floor(Math.random()*23)
p.filters.revealTrans.stop()
p.filters.revealTrans.apply()
}
}

function playeffect(){
var p = document.getElementById('photoslider')
if(p && p.filters){
p.filters.revealTrans.play()
}
}

function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}

function setBlurb(index){
document.getElementById('blurb').innerHTML=blurbs[index];
var html = getFormHtml(index).toString();
document.getElementById('forms1').innerHTML=html
}

function transitionTo(index){
applyeffect();
var img=document.getElementById('photoslider');
img.onLoad = setBlurb(index);
img.src = photos[index];
playeffect();
keeptrack();
}

function backward(){
if (which>0){
which--
transitionTo(which)
if(which==0) document.getElementById('previousControl').innerHTML=""
if(which < photos.length-1) document.getElementById('nextControl').innerHTML=nextLink
}
}

function forward(){
if (which<photos.length-1){
which++
transitionTo(which)
if(which > 0) document.getElementById('previousControl').innerHTML=previousLink
if(which==photos.length-1) document.getElementById('nextControl').innerHTML=""
}
}

