﻿
/*--Start IMAGE SCROLLING--*/

var SLIDETIMER = 3;
var SLIDESPEED = 3;
var SCROLLTIMER = 3;
var SCROLLSPEED = 3;
var STARTINGOPACITY = 40;

// handles manual scrolling of the content //
function scrollContent(id,dir) {
  var div = document.getElementById(id);
  clearInterval(div.timer);
  var sections = div.getElementsByTagName('div');
  var length = sections.length;
  var limit;
  if(dir == -1) {
    limit = 0;
  } else {
    if(length > 1) {
      limit = sections[length-1].offsetTop;
    } else {
      limit = sections[length-1].offsetHeight - div.parentNode.offsetHeight + 20;
    }
  }
  div.style.opacity = STARTINGOPACITY * .01;
  div.style.filter = 'alpha(opacity=' + STARTINGOPACITY + ')';
  div.timer = setInterval( function() { scrollAnimate(div,dir,limit) }, SCROLLTIMER);
}

function scrollAnimate(div,dir,limit) {
  div.style.top = div.style.top || '0px';
  var top = div.style.top.replace('px','');
  if(dir == 1) {
	if(limit - Math.abs(top) <= SCROLLSPEED) {
	  cancelScroll(div.id);
	  div.style.top = '-' + limit + 'px';
	} else {
	  div.style.top = top - SCROLLSPEED + 'px';
	}
  } else {
	if(Math.abs(top) - limit <= SCROLLSPEED) {
	  cancelScroll(div.id);
	  div.style.top = limit + 'px';
	} else {
	  div.style.top = parseInt(top) + SCROLLSPEED + 'px';
	}
  }
}

// cancel the scrolling on mouseout //
function cancelScroll(id) {
  var div = document.getElementById(id);
  div.style.opacity = 1;
  div.style.filter = 'alpha(opacity=100)';
  clearTimeout(div.timer);
}



/*--End IMAGE SCROLLING--*/


/*--Start VIDEO EMBED--*/
//create Video Embed
function ShowEmbedById(imgID)
{

 
   var id=imgID.split('_');
   
   //*--for videopage.aspx
  // var src='http://www.youtube.com/v/'+id[2]+'&hl=en&fs=1';
  
  //*--for modules/video.ascx
  var src='http://www.youtube.com/v/'+id[3]+'&hl=en&fs=1';
 
   html='<span id="vidoshow">'+
        ' <object id="videoobject" width="460" height="314">'+
        '<param name="movie" value="'+src+'" />'+
        '<param name="allowFullScreen" value="true" />'+
        '<param name="allowscriptaccess" value="always" />'+
        '<embed src="'+src+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="460" height="314"></embed>'+
        '</object></span>';         
           
  var newElement=document.createElement('span');
  var oldElement=document.getElementById('vidoshow'); 
  
  newElement.id='vidoshow';
  newElement.innerHTML=html;
  oldElement.parentNode.replaceChild(newElement,oldElement);  
}
/*--END VDEO EMBED--*/

function ShowComp_flashon()
{
     var  comp=' <object  '+
                    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'+
                     ' width="216" height="108" >'+                                  
                     ' <param name="movie" value="images/flash/dncbanner_rollover.swf"/>'+
                     '<param name="quality" value="high" />'+
                     '<param name="wmode" value="transparent" />'+
                     ' <embed src="images/flash/dncbanner_rollover.swf" wmode="transparent" quality="high"'+ 
                     ' pluginspage="http://www.macromedia.com/go/getflashplayer"'+
                     'type="application/x-shockwave-flash" '+
                     ' width="216" height="108" />'+
            '</object>';
                                                           
      var newflash=document.createElement('span');
      var oldflash=document.getElementById('comp_span'); 
  
      newflash.id='comp_span';
      newflash.innerHTML=comp;
      oldflash.parentNode.replaceChild(newflash,oldflash);
     
                                                     
 }
 
 function ShowComp_flashout()
{
     var  comp2=' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  '+
                    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"'+
                     ' width="216" height="108" >'+                                  
                     ' <param name="movie" value="images/flash/dncbanner.swf"/>'+
                     '<param name="quality" value="high" />'+
                     '<param name="wmode" value="transparent" />'+
                     ' <embed src="images/flash/dncbanner.swf" wmode="transparent" quality="high"'+ 
                     ' pluginspage="http://www.macromedia.com/go/getflashplayer"'+
                     'type="application/x-shockwave-flash" '+
                     ' width="216" height="108" />'+
            '</object>';
          

                                                           
      var newflash2=document.createElement('span');
      var oldflash2=document.getElementById('comp_span'); 
  
      newflash2.id='comp_span';
      newflash2.innerHTML=comp2;
      oldflash2.parentNode.replaceChild(newflash2,oldflash2);  
                                             
 }
 




