function toggle_lb(div_id) 
{
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}

function blanket_size_lb(div_idVar, popupheight) 
{
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	
	//var x = $(window).width();
	//var blanket_height = $(document).height(); 
	var blanket = document.getElementById('blanket_lb');
	blanket.style.height = blanket_height + "px"; //blanket_height + "px";
	var div_id = document.getElementById(div_idVar);
	div_id_height= 175; // - popupheight/4; //blanket_height/3-popupheight/2;//100 is half popup's height
	div_id.style.top = div_id_height + 'px';
}

function window_pos_lb(div_idVar, popupwidth) 
{
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var div_id = document.getElementById(div_idVar);
	window_width=window_width/2-popupwidth/2;//150 is half popup's width
	div_id.style.left = window_width + 'px';
}

function popup_lb(windowname, popupwidth, popupheight) 
{
	blanket_size_lb(windowname, popupheight);
	window_pos_lb(windowname, popupwidth);
	toggle_lb('blanket_lb');
	toggle_lb(windowname);		
}

  function  goToStep2()
  {
	popup_lb('register', 450, 550);
  }


var default_fs=12;
var default_lh=17;

function changeFontSize(size, height) {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++)
   {
      p[i].style.fontSize = size+"px"
	  p[i].style.lineHeight = height+"px"
   }
}

function movedown1(){
if (iens6&&parseInt(crossobj1.style.top)>=(contentheight1*(-1)+100))
crossobj1.style.top=parseInt(crossobj1.style.top)-speed+"px"
else if (ns4&&crossobj1.top>=(contentheight1*(-1)+100))
crossobj1.top-=speed
movedownvar1=setTimeout("movedown1()",20)
}

function moveup1(){
if (iens6&&parseInt(crossobj1.style.top)<=0)
crossobj1.style.top=parseInt(crossobj1.style.top)+speed+"px"
else if (ns4&&crossobj1.top<=0)
crossobj1.top+=speed
moveupvar1=setTimeout("moveup1()",20)

}

function getcontent_height1(){
if (iens6)
contentheight1=crossobj1.offsetHeight
else if (ns4)
document.nscontainer1.document.nscontent1.visibility="show"
}



function movedown2(){
if (iens6&&parseInt(crossobj2.style.top)>=(contentheight2*(-1)+100))
crossobj2.style.top=parseInt(crossobj2.style.top)-speed+"px"
else if (ns4&&crossobj2.top>=(contentheight2*(-1)+100))
crossobj2.top-=speed
movedownvar2=setTimeout("movedown2()",20)
}

function moveup2(){
if (iens6&&parseInt(crossobj2.style.top)<=0)
crossobj2.style.top=parseInt(crossobj2.style.top)+speed+"px"
else if (ns4&&crossobj2.top<=0)
crossobj2.top+=speed
moveupvar2=setTimeout("moveup2()",20)

}

function getcontent_height2(){
if (iens6)
	contentheight2=crossobj2.offsetHeight
else if (ns4)
	document.nscontainer2.document.nscontent2.visibility="show"
}




function change_image(elem, image)
{
	var element2change = document.getElementById(elem);
	//alert(element2change.name);
	element2change.src=image+'.gif';
}

/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    
    
   //var $active = $('#slideshow_b IMG.active');
	//alert('active div: '+$active);
   //if ( $active.length == 0 ) $active = $('#slideshow_b IMG:last');

   // use this to pull the images in the order they appear in the markup
   //var $next =  $active.next().length ? $active.next()
   //: $('#slideshow_b IMG:first');

   //$active.addClass('last-active');

   //$next.css({opacity: 0.0})
   //.addClass('active')
   //.animate({opacity: 1.0}, 1000, function() {
   //$active.removeClass('active last-active');
   //});
   
   var at_the_moment = $('#slideshow_b IMG.active');
   //alert('at:' + at_the_moment);
   if ( at_the_moment == 0 ) at_the_moment = $('#slideshow_b IMG:last');
   var next =  at_the_moment.next().length ? at_the_moment.next()
   	: $('#slideshow_b IMG:first');

   at_the_moment.addClass('last-active');

   next.css({opacity: 0.0})
   	.addClass('active')
   	.animate({opacity: 1.0}, 1000, function() {
   		at_the_moment.removeClass('active last-active');
   });
}



function MainSlideSwitch() {
    var $active_div = $('#slideshow_main DIV.active_div');
    //alert('active div: '+$next);

    if ( $active_div.length == 0 ) $active_div = $('#slideshow_main DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active_div.next().length ? $active_div.next()
        : $('#slideshow_main DIV:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active_div.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active_div')
        .animate({opacity: 1.0}, 1000, function() {
            $active_div.removeClass('active_div last-active');
        });
        
}



var curr_lb_div;
var is_modal = false;

function ShowLightBox(lb_div, isModal)
{
	//alert(lb_div);
    document.getElementById(lb_div).style.display='block';
    document.getElementById('fade').style.display='block';
    curr_lb_div = lb_div;
    if (isModal)
        is_modal = true;
    else is_modal = false;
}

function HideLightBox()
{
    if (document.getElementById(curr_lb_div))
    {
         document.getElementById(curr_lb_div).style.display='none';
         document.getElementById('fade').style.display='none';
         curr_lb_div = '';
    }
}
var current_dot = 1;
function change_dots(all_dots, current_2, previous_2)
{
		var next_dot = current_dot+1;
		if(next_dot > all_dots)
		{
			next_dot = 1;
			previous_dot = current_dot;
			
			document.getElementById('dot_'+previous_dot).src=previous_2; //back 2 black
			document.getElementById('dot_'+next_dot).src=current_2; //go 2 white
			current_dot = 0;
		}
		else
		{
			previous_dot = current_dot;
			
			document.getElementById('dot_'+previous_dot).src=previous_2; //back 2 black
			document.getElementById('dot_'+next_dot).src=current_2; //go 2 white
		}
		
		current_dot = current_dot+1;
}

function open_div(current_div, siteUrl)
{
	if(document.getElementById('div_'+current_div).style.display=='block')
	{
		document.getElementById('div_'+current_div).style.display='none';
		document.getElementById('mdiv_'+current_div).className='results_folder clactive';
		document.getElementById('img_'+current_div).src=siteUrl+'images/arrow_down.png';
	}
	else
	{
		document.getElementById('div_'+current_div).style.display='block';
		document.getElementById('mdiv_'+current_div).className='results_folder_on clactive';
		document.getElementById('img_'+current_div).src=siteUrl+'images/arrow_down_on.png';
	}
	var div_height = document.getElementById('div_'+current_div).offsetHeight;
	var content_height = document.getElementById('main_content_content').offsetHeight;
	
	var newheight = content_height*1 + div_height*1 - 40;
	document.getElementById("main_content_content").style.height=newheight+ 'px';

	expand_placeholders();
}



