function OpenExternalLink(Url) {
    window.open(Url);
}

var Drfind;
window.onload = function() {
    Drfind = new SDSlider("Accordion");
    Drfind.init();
    Drfind.submenus[0].className = "current";
    Drfind.submenus[1].className = "collapsed";
};


/*Carousal Starts here*/
var $j = jQuery.noConflict();

var isloading = true;

$j(document).ready(function() {

    //jCarousel Plugin
    $j('#carousel').jcarousel({
        vertical: true,
        scroll:1,
        auto: 13,
        wrap: 'both',
        initCallback: load_initCallback,
        itemFirstInCallback: { onBeforeAnimation: load_itemFirstInCallback }
        
    });

    //Front page Carousel - Initial Setup
   /* $j('div#slideshow-carousel a img').css({ 'opacity': '1.0' });
    $j('div#slideshow-carousel a img:first').css({ 'opacity': '1.0' });
    $j('div#slideshow-carousel li a:first').append('<span class="arrow"></span>')*/

    $j('div#slideshow-carousel a img').css({ 'opacity': '1.0' });
    $j('div#slideshow-carousel a img:last').css({ 'opacity': '1.0' });
    $j('div#slideshow-carousel li a:last').append('<span class="arrow"></span>')

    //Combine jCarousel with Image Display
    $j('div#slideshow-carousel li a').load(
       	function() {

       	    if (!$j(this).has('span').length) {
       	        $j('div#slideshow-carousel li a img').stop(true, true).css({ 'opacity': '1.0' });
       	        $j(this).stop(true, true).children('img').css({ 'opacity': '1.0' });
       	    }
       	}
	).click(function() {
	    $j('span.arrow').remove();
	    $j(this).append('<span class="arrow"></span>');
      var index = $j(this).attr('rel');
      index = index.replace('p','');
      index = parseInt(index) - 1;
      var wide = $j('div#slideshow-main ul li:first').outerWidth(true) * -1;
      var leftness = wide * index;
      $j('div#slideshow-main ul').animate({left: leftness},300);
      return false;
	});

  var wholeWidth = $j('div#slideshow-main ul li').size() * $j('div#slideshow-main ul li:first').outerWidth(true);
  $j('div#slideshow-main ul').width(wholeWidth);

});



function load_initCallback(carousel) {
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
}
function load_itemFirstInCallback(carousel, item, index) {
    var wide = $j('div#slideshow-main ul li:first').outerWidth(true) * -1;
    var leftness = 0;
  if (isloading) {
      leftness = wide * 0;
      isloading = false;
  }
  else {
      leftness = wide * index;
  }
  $j('div#slideshow-main ul').animate({left: leftness},300);
  /*
  var num = index + 1;
  var pre = index;
  if(num == 2) { pre = 5; }
  $j('div#slideshow-main li.p' + pre).animate({left:-602},500);
  $j('div#slideshow-main li.p' + num).show().animate({left:0},500);
*/
  }

/*Carousal Ends here*/

/*Iframe window height increase */
function calcHeight(obj) {
    //find the height of the internal page
    var the_height = obj.contentWindow.document.body.scrollHeight;
    //document.getElementById(id)

    //change the height of the iframe
    obj.height = the_height;
 
}
/*Iframe window height increase */

