// Digital Lines Ltd - Jscript Tool Pack V1.00

// HomePage Rollover Button Content


var WW_MainMenuContent = [
 ["index","<h3>Want to play a Prank Call on someone ?</h3>Have you ever wanted to play a Telephone Prank Call on someone but were too afraid of them finding out?<br /><br />Look no further ... 'Wacky Prank Calls' brings you a hilarious selection of prank calls you can play on your friends, family or anyone else you think deserves it!<br /><br /><span>To WindUp someone now, click <a href=\"prank-calls-list.php\"><img src=\"media/gif/start.gif\" alt=\"Start making Prank Calls\" border=\"0\" class=\"absmiddle_start\" /></a></span><br/><br/>Listen in secretly as we call your 'Victim' and play the WindUp on them. You can shout, scream or laugh! They will never know it's you !<br /><br />These prank calls (also known as Wind Up Calls, Phone Pranks or Jokelines) are very realistic, they actually respond to what your 'victim' is saying!"],
 ["my-acc-home","<h3>Your Prank Account</h3>"],
 ["my-acc-control-panel","<h3>Prank Control Panel</h3><br/><br/>"],
 ["prank-calls-list","<h3>Selecting a Prank</h3>The 'Prank List' is the best place to get started.<br/><br/>With over 30 prank call characters to choose from  ... No one escapes!<br/><br/>Find out more about them, how to make a call and see some funny samples beforehand !<br/><br/>"],
 ["how-it-works","<h3>How does it all work?</h3>How do I make a Prank Call?<br/><br/>Follow this simple 6 step guide on how to start prank calling your friends!<br/><br/>"],
 ["how-it-works-acc","<h3>How does it all work?</h3>How do I make a Prank Call?<br/><br/>Follow this simple 6 step guide on how to start prank calling your friends!<br/><br/>"],
 ["special-features","<h3>Wacky Special Features</h3>To make your Wind Up experience more realistic, our service has all the latest features and more.<br/><br/>There simply is nothing else like it, But please have a look for yourself !<br/><br/>"],
 ["my-pranks-recorded","<h3>My Prank Call Recordings</h3>At last you can re\-live the moment and listen to all your recorded prank calls with a few simple clicks.<br\/><br\/><img src=\"media\/png\/myprankcalls\/my_pranks_screen.png\" alt=\"Inside view of My Pranks.\"\/><br/><br/>"],
 ["keepmeposted","<h3>Keep Me Posted!</h3>From time to time, we'd like to update you with any new Prank Calls, features or events, by sending a quick email.<br/><br/>We Promise not to bombard you with junk. Usually only one email per month and you can stop at anytime.<br/><br/>"],
 ["strange-facts","<h3>Strange facts</h3>Some strange but quite interesting facts we discovered about \'Wacky\' whilst board one day!<br/><br/>"],
 ["faqs","<h3>Frequently as questions</h3>We've compiled a list of some of the most popular questions we\'re asked about the service.<br/><br/>"],
 ["mobile-wacky","<h3>Wacky on your Mobile</h3>As it sounds!<br/><br/>Find out how you can get Wacky Prank Calls on the move from your mobile.<br/><br/>"],
 ["our-friends","This is some of our friends.<br/><br/>Regards<br/>Team Wacky<br/><br/>"],
 ["stop-calling","<h3>Stop Calling me?</h3>If you don\'t wish to receive any more prank calls or wind-ups, click here to add your phone number to the Wacky \'barred from calling list\'<br/><br/>"],
 ["feedback","<h3>Your Feedback</h3>If you have the time, we\'d really appreciate your feedback, good or bad !<br/><br/>Here\'s a simple feedback form with some quick choice options to let us know what you think.<br/><br/>"],
 ["feedback-acc","<h3>Your Feedback</h3>If you have the time, we\'d really appreciate your feedback, good or bad !<br/><br/>Here\'s a simple feedback form with some quick choice options to let us know what you think.<br/><br/>"],
 ["legal-bumph","<h3>Legal Bumph</h3>Some legal stuff, the usual, terms &amp; conditions etc!<br/><br/>But please have a read first!<br/><br/>"],
 ["contact-us","<h3>Contact Us</h3>If you need to get in touch for any reason, please fill out this form and send us an email.<br/><br/>"]
];



var WW_RollTitles = new Array (
"<b>SCREEN SHOT FROM INSIDE 'MY PRANKS'</b><br/><br/><img src=\"media\/png\/myprankcalls\/my_pranks_screen.png\" alt=\"Inside view of My Pranks.\"\/>");





// Changes text in main speech bubble

function WW_MainMenuSpeechRollover(MouseDirection,ButtonId,InerHTMLOutputId)  {
    for(i=0;WW_MainMenuContent.length-1;i++)
      { if (WW_MainMenuContent[i][0] == ButtonId)
           {
             if (MouseDirection == 'on')
               {
                 MM_setTextOfLayer(InerHTMLOutputId,'',WW_MainMenuContent[i][1]);
                 return true;
               };
             if (MouseDirection == 'off')
               {
                 MM_setTextOfLayer(InerHTMLOutputId,'',WW_MainMenuContent[i][1]);
                 return true;
               };
           }
      }
};



// Rollover / Pre-Load Image Functions Used above

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
};

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
};

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
};

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
};


// InnerHTML Text replacing function

function MM_setTextOfLayer(objId,x,newText) { //v9.0
  with (document) if (getElementById && ((obj=getElementById(objId))!=null))
    with (obj) innerHTML = unescape(newText);
};





/***********************************************
* JavaScript Sound effect- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/


function PlaySound(soundfile,outputid){
if (document.all && document.getElementById){
document.getElementById(outputid).src=""
document.getElementById(outputid).src=soundfile
}
};

// Adds the sound effect  to all elements of a certain type (-ie: links)
function bindsound(tag, soundfile, masterElement){
if (!window.event) return
var source=event.srcElement
while (source!=masterElement && source.tagName!="HTML"){
if (source.tagName==tag.toUpperCase()){
playsound(soundfile)
break
}
source=source.parentElement
}
};


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/


/* Modified to support Opera */
function BookMark(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}


//  WPC Keep Me posted Email Function from Main Menu
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function KeepMePosted(SwapImageId,FormFeildId)
 {
  var EmailAddr = document.getElementById(FormFeildId).value;
  if (EmailAddr!='' && CheckEmail(EmailAddr)) {
   PopPage(SwapImageId,'src','/media/png/keepme_sending.png');
   
        try
          {
		   var PostCalledFunction = 'CommPHPUpdateElm("'+SwapImageId+'","src","/media/png/","","TX_RESPONSE_PLACEHOLDER");';
		   CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/keepme/keepme?emaddr='+EmailAddr,PostCalledFunction );
		   document.getElementById(FormFeildId).value = '';
		   document.getElementById('sendwu_toname').value="";
		   document.getElementById('sendwu_toemail').value="";
		   document.getElementById('sendwu_fromname').value="";
          }
        catch(err)
          {
           PopPage(SwapImageId,'src','/media/png/keepme_fail.png');
          };
   }
   else
   { PopPage(SwapImageId,'src','/media/png/keepme_bad.png');
   };
 };
 



// Check if number
function CheckNumber(Numb){

//if(isNaN(my_string)){
//document.write ("this is not a number ");
//}else{document.write ("this is a number ");
//}

		if (isNaN(Numb) ){
			return (-1);
		}
};


//  Stop Calling me Function on Stop calling me page
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function StopCallingMe(OutputId,FormTnumId,FormCommId)
 {
  var UserTnum = document.getElementById(FormTnumId).value;
  var UserComm = document.getElementById(FormCommId).value;
  UserTnum = UserTnum.replace(/ /g,"");
  UserTnum = UserTnum.replace(/-/g,"");
  UserTnum = UserTnum.replace(/\+/g,"");
  UserTnum = UserTnum.replace(/\)/g,"");
  UserTnum = UserTnum.replace(/\(/g,"");

  document.getElementById(OutputId).innerHTML = "Adding phone number '"+UserTnum+"' to the Wacky barred caller list." ;
  if (UserTnum!='' && !isNaN(UserTnum) ) {

     if (UserTnum.length<=9) {
     PopPage(OutputId,'innerHTML','Too short, Please enter a valid telephone including the area code?');
     return;
      };
	  
	  
	    try
          {
		   var PostCalledFunction = 'CommPHPUpdateElm("'+OutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		   CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/stopcalls/stopcalls?tnum='+UserTnum+'&ucomm='+UserComm,PostCalledFunction );
		   document.getElementById(FormTnumId).value = '';
		   document.getElementById(FormCommId).value = '';
          }
        catch(err)
          {
           PopPage(OutputId,'innerHTML','Sorry there was an error, please try again?');
          };
    }
    else
    { PopPage(OutputId,'innerHTML','Please enter a valid telephone number above?'); };
 };




//  Send EMail PHP function call
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function SendContactEmail(OutputId,FormNameId,FormEmailId,FormMsgId)
 {
  var UserName = document.getElementById(FormNameId).value;
  var UserEmail = document.getElementById(FormEmailId).value;
  var UserMesg = document.getElementById(FormMsgId).value;
  if (UserEmail!=''&& CheckEmail(UserEmail) ) {
  document.getElementById(OutputId).innerHTML = "Sending information ..." ;
        try
          {
	      var PostCalledFunction = 'CommPHPUpdateElm("'+OutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		  CommPHP_Routed('/php/scripts/TPackEmail.php', '?usremail='+UserEmail+'&usrname='+UserName+'&usrmesg='+UserMesg,PostCalledFunction );
          }
        catch(err)
          {
          document.getElementById(OutputId).innerHTML = "Sorry, there has been an error sending this message, please try again. Or use contact us via comments@wackyprankcalls.com."
          };
  document.getElementById(FormNameId).value = '';
  document.getElementById(FormEmailId).value = '';
  document.getElementById(FormMsgId).value = '';
  }
  else
  { PopPage(OutputId,'innerHTML','Please include a valid email address.');
  };
 };





//  Search for prank calls function.
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function SearchMyPranks(OutputId,FormYrTnumId,FormVicTnumId)
 {
  var UserTnum = document.getElementById(FormYrTnumId).value;
  var UserVicTnum = document.getElementById(FormVicTnumId).value;
  UserTnum = UserTnum.replace(/ /g,"");
  UserTnum = UserTnum.replace(/-/g,"");
  UserVicTnum = UserVicTnum.replace(/ /g,"");
  UserVicTnum = UserVicTnum.replace(/-/g,"");
  if (UserTnum!='' && UserVicTnum!='') {

        try
          {
		  document.getElementById(OutputId).innerHTML = "Searching for "+UserVicTnum+"."; 
		  var PostCalledFunction = 'CommPHPUpdateElm("'+OutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
          CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/mypranks/searchres?tnum='+UserTnum+'&victnum='+UserVicTnum,PostCalledFunction );
          }
        catch(err)
          {
          document.getElementById(OutputId).innerHTML = "Sorry, there has been an error getting your pranks, please try again."
          };

    }
    else
    { document.getElementById(OutputId).innerHTML = "Please enter both phone numbers in the boxes above." ; };
 };




//  Search for prank calls function.
//  CommPHP_Routed(url, parameters,PostCalledFunction)
//  EG: SearchMyPranks('myprank_searchres','myprank_yrtnum','myprank_victnum');

function WackySWFFile(OutputId,FileId,VTnum,ITnum)
 {
  if (FileId!='' && ITnum!='' && ITnum!='') {

        try
          {
		  document.getElementById(OutputId).innerHTML = "Please wait while Wacky gets the recording for "+VTnum+" and makes a video, this may take up to a minute." ;
		  var PostCalledFunction = 'CommPHPUpdateElm("'+OutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		  CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/upload/fsftp?fid='+FileId+'&tnumvic='+VTnum+'&tnuminst='+ITnum,PostCalledFunction);
          }
        catch(err)
          {
          document.getElementById(OutputId).innerHTML = "Sorry there has been an error, please try again."
          };
    }
    else
    { document.getElementById(OutputId).innerHTML = "Sorry there has been an error, please try again." ; };
 };

//   http://online.digitallines.co.uk:6670/pb_/wacky/upload/fsftp?fid=118280&tnumvic=07817639737&tnuminst=01179080507




//  Prank Call Render & Download.
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function WackyPrankJigger(OutputId,FileId,VTnum,ITnum,FileStatus,FName,FPath)
 {
    document.getElementById(OutputId).innerHTML = ""
    var FileStatusByImg = document.getElementById('myp_imgstatus_'+FileId).src;
    var Arr= FileStatusByImg.split("/");
    FileStatusByImg = Arr[Arr.length-1];
    FileStatusByImg = FileStatusByImg.replace('mpstatus_','');
    FileStatusByImg = FileStatusByImg.replace('.png','');
    if (FileStatus!=FileStatusByImg || FileStatus!='') {FileStatus = FileStatusByImg;  };

    switch(FileStatus)
    {
    case 'stored':

        try
          {
          //alert(FPath+FName) ;
          createplayer(FPath+FName, true);
          }
        catch(err)
          {
          document.getElementById(OutputId).innerHTML = "Sorry, there has been an error playing this Prank file."
          };
      break;

    case '':

        try
          {
            if (FileId!='' && ITnum!='' && ITnum!='') {
              document.getElementById('myp_imgstatus_'+FileId).src = "/media/png/myprankcalls/mpstatus_uploading.gif" ;
              document.getElementById(OutputId).innerHTML = "Uploading recording for "+VTnum+", this may take a minute!" ;
		      var PostCalledFunction = 'CommPHPUpdateElm("myp_tdstatus_'+FileId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';			  
              CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/upload/fsftp?fid='+FileId+'&tnumvic='+VTnum+'&tnuminst='+ITnum,PostCalledFunction );
            }
            else { document.getElementById(OutputId).innerHTML = "Sorry, there has been an error uploading this Prank file. [1]" ; };

          }
        catch(err)
          {
          document.getElementById(OutputId).innerHTML = "Sorry, there has been an error uploading this Prank file. [2]";
          };
      break;

    case 'failed':
      document.getElementById(OutputId).innerHTML = "Sorry, but this Prank file cannot be retrieved.";
      break;
    case 'unkn':
      document.getElementById(OutputId).innerHTML = "Sorry, but this Prank file cannot be retrieved, reason unknown.";
      break;
    case 'blocked':
      document.getElementById(OutputId).innerHTML = "Sorry, but this Prank file has been blocked by the \'victim\'.";
      break;
    case 'uploading':
      document.getElementById(OutputId).innerHTML = "Please wait, still uploading the Prank file.";
      break;
    default:
      document.getElementById(OutputId).innerHTML = "Sorry, but there is an unknown error with this Prank file.";
    };

 };



//  My Prank Call Terms and conditions check box.

 function MyPrankTC(CheckId,OutputId)
 {
  if (document.getElementById(CheckId).checked == true) {
    window.open('my-pranks-search.php','_self');
  }
  else {
    document.getElementById(OutputId).innerHTML = "Please read the above and check the box to confirm you have read it." ;
  }
 };


//  Pink Strap Line News Ticker Tape.

var pausecontent=new Array()
pausecontent[0]='<a href="prank-calls-list.php"><span class="strap_text_white">INTELLIGENT SPEECH RECOGNITION PRANK CALLS THAT </span><span class="strap_text_yellow">ACTUALLY SAY</span><span class="strap_text_white"> THE VICTIMS NAME!!</a></span>'
pausecontent[1]='<a href="recorded-prank-calls.php"><span class="strap_text_yellow">NEW SERVICE! </span><span class="strap_text_white">CLICK ON \'MY PRANKS\' TO LISTEN TO ALL THE PRANK CALLS YOU\'VE MADE!</a></span>'
pausecontent[2]='<span class="strap_text_yellow">PRE-PAY WITH PAYPAL </span><span class="strap_text_white">CLICK ME TO FIND OUT HOW TO GET A WACKY ACCOUNT!</span>'

/***********************************************
* Pausing up-down scroller- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}



/************************************************************************************************************
DIV DROPDOWN MECHANISM

(C) www.dhtmlgoodies.com, September 2005

This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.

Terms of use:
See http://www.dhtmlgoodies.com/index.html?page=termsOfUse

Thank you!

www.dhtmlgoodies.com
Alf Magne Kalleland

************************************************************************************************************/

var slideDownInitHeight = new Array();
var slidedown_direction = new Array();
var slidedownActive = false;
var contentHeight = false;
var slidedownSpeed = 12; 	// Higher value = faster script
var slidedownTimer = 7;	// Lower value = faster script

function slidedown_showHide(boxId)
{
	if(!slidedown_direction[boxId])slidedown_direction[boxId] = 1;
	if(!slideDownInitHeight[boxId])slideDownInitHeight[boxId] = 0;

	if(slideDownInitHeight[boxId]==0)slidedown_direction[boxId]=slidedownSpeed; else slidedown_direction[boxId] = slidedownSpeed*-1;

	slidedownContentBox = document.getElementById(boxId);
	var subDivs = slidedownContentBox.getElementsByTagName('DIV');
	for(var no=0;no<subDivs.length;no++){
		if(subDivs[no].className=='dhtmlgoodies_content')slidedownContent = subDivs[no];
	}

	contentHeight = slidedownContent.offsetHeight;

	slidedownContentBox.style.visibility='visible';
	slidedownActive = true;
	slidedown_showHide_start(slidedownContentBox,slidedownContent);
}
function slidedown_showHide_start(slidedownContentBox,slidedownContent)
{

	if(!slidedownActive)return;
	slideDownInitHeight[slidedownContentBox.id] = slideDownInitHeight[slidedownContentBox.id]/1 + slidedown_direction[slidedownContentBox.id];
	if(slideDownInitHeight[slidedownContentBox.id] <= 0){
		slidedownActive = false;
		slidedownContentBox.style.visibility='hidden';
		slideDownInitHeight[slidedownContentBox.id] = 0;
	}
	if(slideDownInitHeight[slidedownContentBox.id]>contentHeight){
		slidedownActive = false;
	}
	slidedownContentBox.style.height = slideDownInitHeight[slidedownContentBox.id] + 'px';
	slidedownContent.style.top = slideDownInitHeight[slidedownContentBox.id] - contentHeight + 'px';

	setTimeout('slidedown_showHide_start(document.getElementById("' + slidedownContentBox.id + '"),document.getElementById("' + slidedownContent.id + '"))',slidedownTimer);	// Choose a lower value than 10 to make the script move faster

    }



// -------------------------------------------------------------------
// Wacky YouTube Interaction ==> Required TPackYouTube.js
// -------------------------------------------------------------------

// REQUIRED =>     <script src="http://swfobject.googlecode.com/svn/tags/rc3/swfobject/src/swfobject.js" type="text/javascript"></script>

        var PlayStateText=new Array("Stopped","Playing","Paused","Loading","Unknown(4)","Cue");

function StopPlayVideo(id, startSeconds,ControlsId,HideImageId) {

        try
          {
              if (ytplayer) {
                if (getPlayerState()!=0) {stop()};
                if (HideImageId!="" && HideImageId!=null) {
                //PopPage(HideImageId,'style','display: none');    wtv_start_img
                document.getElementById(HideImageId).style.display = "none";
                };
                unMute();
                loadNewVideo(id, startSeconds);
              };
          }
        catch(err)
          {
               if (HideImageId!="" && HideImageId!=null) {
               document.getElementById(HideImageId).style.display = "none";}
          };

};


function PlayCheck(OutPutId) {
          if (getPlayerState()<=0) {
           //document.getElementById(OutPutId).style.display = "block";
           PopPage(OutPutId,'innerHTML','To play a sample, please click on one of the <img src="media/png/play_sample.png" alt="Play Prank Sample" class="absmiddle"/> buttons from the list on the left first!<br\/>Or click <img src="media/png/char_info.png" alt="More prank info &amp; Help on ordering" class="absmiddle"/> for more info &amp; how to get started.');
           // document.getElementById(HideImageId).style.display = "none";
           }
           else
           {play();}
};





/* SpryTabbedPanels.js - Revision: Spry Preview Release 1.4 */

// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//   * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//   * Neither the name of Adobe Systems Incorporated nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

var Spry;
if (!Spry) Spry = {};
if (!Spry.Widget) Spry.Widget = {};

Spry.Widget.TabbedPanels = function(element, opts)
{
	this.element = this.getElement(element);
	this.defaultTab = 0; // Show the first panel by default.
	this.bindings = [];
	this.tabSelectedClass = "TabbedPanelsTabSelected";
	this.tabHoverClass = "TabbedPanelsTabHover";
	this.tabFocusedClass = "TabbedPanelsTabFocused";
	this.panelVisibleClass = "TabbedPanelsContentVisible";
	this.focusElement = null;
	this.hasFocus = false;
	this.currentTabIndex = 0;
	this.enableKeyboardNavigation = true;

	Spry.Widget.TabbedPanels.setOptions(this, opts);

	// If the defaultTab is expressed as a number/index, convert
	// it to an element.

	if (typeof (this.defaultTab) == "number")
	{
		if (this.defaultTab < 0)
			this.defaultTab = 0;
		else
		{
			var count = this.getTabbedPanelCount();
			if (this.defaultTab >= count)
				this.defaultTab = (count > 1) ? (count - 1) : 0;
		}

		this.defaultTab = this.getTabs()[this.defaultTab];
	}

	// The defaultTab property is supposed to be the tab element for the tab content
	// to show by default. The caller is allowed to pass in the element itself or the
	// element's id, so we need to convert the current value to an element if necessary.

	if (this.defaultTab)
		this.defaultTab = this.getElement(this.defaultTab);

	this.attachBehaviors();
};

Spry.Widget.TabbedPanels.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
}

Spry.Widget.TabbedPanels.prototype.getElementChildren = function(element)
{
	var children = [];
	var child = element.firstChild;
	while (child)
	{
		if (child.nodeType == 1 /* Node.ELEMENT_NODE */)
			children.push(child);
		child = child.nextSibling;
	}
	return children;
};

Spry.Widget.TabbedPanels.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.TabbedPanels.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

Spry.Widget.TabbedPanels.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
{
	if (!optionsObj)
		return;
	for (var optionName in optionsObj)
	{
		if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
			continue;
		obj[optionName] = optionsObj[optionName];
	}
};

Spry.Widget.TabbedPanels.prototype.getTabGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length)
			return children[0];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getTabs = function()
{
	var tabs = [];
	var tg = this.getTabGroup();
	if (tg)
		tabs = this.getElementChildren(tg);
	return tabs;
};

Spry.Widget.TabbedPanels.prototype.getContentPanelGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length > 1)
			return children[1];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getContentPanels = function()
{
	var panels = [];
	var pg = this.getContentPanelGroup();
	if (pg)
		panels = this.getElementChildren(pg);
	return panels;
};

Spry.Widget.TabbedPanels.prototype.getIndex = function(ele, arr)
{
	ele = this.getElement(ele);
	if (ele && arr && arr.length)
	{
		for (var i = 0; i < arr.length; i++)
		{
			if (ele == arr[i])
				return i;
		}
	}
	return -1;
};

Spry.Widget.TabbedPanels.prototype.getTabIndex = function(ele)
{
	var i = this.getIndex(ele, this.getTabs());
	if (i < 0)
		i = this.getIndex(ele, this.getContentPanels());
	return i;
};

Spry.Widget.TabbedPanels.prototype.getCurrentTabIndex = function()
{
	return this.currentTabIndex;
};

Spry.Widget.TabbedPanels.prototype.getTabbedPanelCount = function(ele)
{
	return Math.min(this.getTabs().length, this.getContentPanels().length);
};

Spry.Widget.TabbedPanels.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};

Spry.Widget.TabbedPanels.prototype.onTabClick = function(e, tab)
{
	this.showPanel(tab);
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOver = function(e, tab)
{
	this.addClassName(tab, this.tabHoverClass);
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOut = function(e, tab)
{
	this.removeClassName(tab, this.tabHoverClass);
};

Spry.Widget.TabbedPanels.prototype.onTabFocus = function(e, tab)
{
	this.hasFocus = true;
	this.addClassName(this.element, this.tabFocusedClass);
};

Spry.Widget.TabbedPanels.prototype.onTabBlur = function(e, tab)
{
	this.hasFocus = false;
	this.removeClassName(this.element, this.tabFocusedClass);
};

Spry.Widget.TabbedPanels.ENTER_KEY = 13;
Spry.Widget.TabbedPanels.SPACE_KEY = 32;

Spry.Widget.TabbedPanels.prototype.onTabKeyDown = function(e, tab)
{
	var key = e.keyCode;
	if (!this.hasFocus || (key != Spry.Widget.TabbedPanels.ENTER_KEY && key != Spry.Widget.TabbedPanels.SPACE_KEY))
		return true;

	this.showPanel(tab);

	if (e.stopPropagation)
		e.stopPropagation();
	if (e.preventDefault)
		e.preventDefault();

	return false;
};

Spry.Widget.TabbedPanels.prototype.preorderTraversal = function(root, func)
{
	var stopTraversal = false;
	if (root)
	{
		stopTraversal = func(root);
		if (root.hasChildNodes())
		{
			var child = root.firstChild;
			while (!stopTraversal && child)
			{
				stopTraversal = this.preorderTraversal(child, func);
				try { child = child.nextSibling; } catch (e) { child = null; }
			}
		}
	}
	return stopTraversal;
};

Spry.Widget.TabbedPanels.prototype.addPanelEventListeners = function(tab, panel)
{
	var self = this;
	Spry.Widget.TabbedPanels.addEventListener(tab, "click", function(e) { return self.onTabClick(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseover", function(e) { return self.onTabMouseOver(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseout", function(e) { return self.onTabMouseOut(e, tab); }, false);

	if (this.enableKeyboardNavigation)
	{
		// XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't
		// rely on adding the tabindex attribute if it is missing to enable keyboard navigation
		// by default.

		// Find the first element within the tab container that has a tabindex or the first
		// anchor tag.

		var tabIndexEle = null;
		var tabAnchorEle = null;

		this.preorderTraversal(tab, function(node) {
			if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
			{
				var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
				if (tabIndexAttr)
				{
					tabIndexEle = node;
					return true;
				}
				if (!tabAnchorEle && node.nodeName.toLowerCase() == "a")
					tabAnchorEle = node;
			}
			return false;
		});

		if (tabIndexEle)
			this.focusElement = tabIndexEle;
		else if (tabAnchorEle)
			this.focusElement = tabAnchorEle;

		if (this.focusElement)
		{
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "focus", function(e) { return self.onTabFocus(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "blur", function(e) { return self.onTabBlur(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "keydown", function(e) { return self.onTabKeyDown(e, tab); }, false);
		}
	}
};

Spry.Widget.TabbedPanels.prototype.showPanel = function(elementOrIndex)
{
	var tpIndex = -1;

	if (typeof elementOrIndex == "number")
		tpIndex = elementOrIndex;
	else // Must be the element for the tab or content panel.
		tpIndex = this.getTabIndex(elementOrIndex);

	if (!tpIndex < 0 || tpIndex >= this.getTabbedPanelCount())
		return;

	var tabs = this.getTabs();
	var panels = this.getContentPanels();

	var numTabbedPanels = Math.max(tabs.length, panels.length);

	for (var i = 0; i < numTabbedPanels; i++)
	{
		if (i != tpIndex)
		{
			if (tabs[i])
				this.removeClassName(tabs[i], this.tabSelectedClass);
			if (panels[i])
			{
				this.removeClassName(panels[i], this.panelVisibleClass);
				panels[i].style.display = "none";
			}
		}
	}

	this.addClassName(tabs[tpIndex], this.tabSelectedClass);
	this.addClassName(panels[tpIndex], this.panelVisibleClass);
	panels[tpIndex].style.display = "block";

	this.currentTabIndex = tpIndex;
};

Spry.Widget.TabbedPanels.prototype.attachBehaviors = function(element)
{
	var tabs = this.getTabs();
	var panels = this.getContentPanels();
	var panelCount = this.getTabbedPanelCount();

	for (var i = 0; i < panelCount; i++)
		this.addPanelEventListeners(tabs[i], panels[i]);

	this.showPanel(this.defaultTab);
};


// WACKY WINDUPS ADDITIONS

//  WW Keep Me posted Email Function from Main Menu
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function WWKeepMePosted(OutputId,FormFeildId)
 {

  var EmailAddr = document.getElementById(FormFeildId).value;
  if (EmailAddr!='' && CheckEmail(EmailAddr)) {
   PopPage(OutputId,'innerHTML','Sending ...');
   
        try
          {
		   var PostCalledFunction = 'CommPHPUpdateElm("'+OutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		   CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky/keepme/keepme_ww?emaddr='+EmailAddr,PostCalledFunction );
		   document.getElementById(FormFeildId).value = '';
          }
        catch(err)
          {
           PopPage(OutputId,'innerHTML','Sorry Failed');
          };
   }
   else
   { PopPage(OutputId,'innerHTML','Bad Email address');
   };
 };



  
//  WW Send to Friend from Main Menu
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function SendToFriend(MsgOutputId,FormYouNameId,FormThemNameId,FormThemEmailId)
 {
  var SendToYourName = document.getElementById(FormYouNameId).value;
  var SendToTheirName = document.getElementById(FormThemNameId).value;
  var SendToTheirEmail = document.getElementById(FormThemEmailId).value;
  if (SendToYourName=='' || SendToTheirName=='') {
	  PopPage(MsgOutputId,'innerHTML','Enter both names');
	  return;
	  }
  if (SendToTheirEmail!='' && CheckEmail(SendToTheirEmail)) {
   PopPage(MsgOutputId,'innerHTML','Sending ...');
   
        try
          {
		   var PostCalledFunction = 'CommPHPUpdateElm("'+MsgOutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		   CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky_ww/send-to/send-to?fromname='+SendToYourName+'&toname='+SendToTheirName+'&toemail='+SendToTheirEmail,PostCalledFunction );
		   return;
          }
        catch(err)
          {
           PopPage(MsgOutputId,'innerHTML','Sorry Failed');
          };
   }
   else
   { PopPage(MsgOutputId,'innerHTML','Bad Email address');
   };
 };
 
 


//  WW Send Email Prank to Friend 
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function SendEmailWindUp(MsgOutputId,FormYouNameId,FormThemNameId,FormThemEmailId)
 {
  var SendToYourName = document.getElementById(FormYouNameId).value;
  var SendToTheirName = document.getElementById(FormThemNameId).value;
  var SendToTheirEmail = document.getElementById(FormThemEmailId).value;
  if (SendToYourName=='' || SendToTheirName=='') {
	  PopPage(MsgOutputId,'innerHTML','Please enter both the names?');
	  return;
	  }
  if (SendToTheirEmail!='' && CheckEmail(SendToTheirEmail)) {
   PopPage(MsgOutputId,'innerHTML','Sending email windup ...');
   
        try
          {
		   var PostCalledFunction = 'CommPHPUpdateElm("'+MsgOutputId+'","innerHTML","","","TX_RESPONSE_PLACEHOLDER");';
		   CommPHP_Routed('/php/scripts/TPackCommCore.php', '?url=http://inet.wackyprankcalls.com:6670/pb_/wacky_ww/send-emailwu/send-emailwu?fromname='+SendToYourName+'&toname='+SendToTheirName+'&toemail='+SendToTheirEmail,PostCalledFunction );
		   return;
          }
        catch(err)
          {
           PopPage(MsgOutputId,'innerHTML','Sorry, there has been a problem, please try again?');
          };
   }
   else
   { PopPage(MsgOutputId,'innerHTML','Bad Email address, please try again?');
   };
 };
 
 

 
  
 //  WW Keep Me posted Email Function from Main Menu
//  CommPHP_Routed(url, parameters,PostCalledFunction)

function ClearInput(InputId,ReplaceWith)
 {
  if (ReplaceWith!="" && document.getElementById(InputId).value!="") {
	  return;	  
  }
  document.getElementById(InputId).value=ReplaceWith;
 };
