

    function clearTextBoxOnCondition(textBox,conditionText){
        if(textBox.value == conditionText)
          textBox.value="";
    }    



image1 = new Image();
image1.src = "arrow_left";
image2 = new Image();
image2.src = "arrow_right";




$.fn.cycle.defaults.timeout = 6000;
$(function() {
    // run the code in the markup!
    $('table pre code').not('#skip,#skip2').each(function() {
        eval($(this).text());
    });
    
    $('#s4').after('<div id="nav" class="nav">').cycle({ 
        fx:     'scrollLeft',
        speed:  'fast',
        timeout: 10000,
        pager:  '#nav'
    });
});





var FDVA_slideSpeed = 50;
var FDVA_timer = 10;
var objectIdToSlideDown = false;
var FDVA_activeId = false;
var FDVA_slideInProgress = false;
var FDVA_expandMultiple = false; // true if you want to be able to have multiple items expanded at the same time.

function showHideContent(e,inputId)
{
	if(FDVA_slideInProgress)return;
	FDVA_slideInProgress = true;
	if(!inputId)inputId = this.id;
	inputId = inputId + '';
	var numericId = inputId.replace(/[^0-9]/g,'');
	var answerDiv = document.getElementById('FDVA_a' + numericId);

	objectIdToSlideDown = false;

	if(!answerDiv.style.display || answerDiv.style.display=='none'){
		if(FDVA_activeId &&  FDVA_activeId!=numericId && !FDVA_expandMultiple){
			objectIdToSlideDown = numericId;
			slideContent(FDVA_activeId,(FDVA_slideSpeed*-1));
		}else{

			answerDiv.style.display='block';
			answerDiv.style.visibility = 'visible';

			slideContent(numericId,FDVA_slideSpeed);
		}
	}else{
		slideContent(numericId,(FDVA_slideSpeed*-1));
		FDVA_activeId = false;
	}
}

function slideContent(inputId,direction)
{

	var obj =document.getElementById('FDVA_a' + inputId);
	var contentObj = document.getElementById('FDVA_ac' + inputId);
	height = obj.clientHeight;
	if(height==0)height = obj.offsetHeight;
	height = height + direction;
	rerunFunction = true;
	if(height>contentObj.offsetHeight){
		height = contentObj.offsetHeight;
		rerunFunction = false;
	}
	if(height<=1){
		height = 1;
		rerunFunction = false;
	}

	obj.style.height = height + 'px';
	var topPos = height - contentObj.offsetHeight;
	if(topPos>0)topPos=0;
	contentObj.style.top = topPos + 'px';
	if(rerunFunction){
		setTimeout('slideContent(' + inputId + ',' + direction + ')',FDVA_timer);
	}else{
		if(height<=1){
			obj.style.display='none';
			if(objectIdToSlideDown && objectIdToSlideDown!=inputId){
				document.getElementById('FDVA_a' + objectIdToSlideDown).style.display='block';
				document.getElementById('FDVA_a' + objectIdToSlideDown).style.visibility='visible';
				slideContent(objectIdToSlideDown,FDVA_slideSpeed);
			}else{
				FDVA_slideInProgress = false;
			}
		}else{
			FDVA_activeId = inputId;
			FDVA_slideInProgress = false;
		}
	}
}



function initShowHideDivs()
{
	var divs = document.getElementsByTagName('DIV');
	var divCounter = 1;
	for(var no=0;no<divs.length;no++){
		if(divs[no].className=='FDVA_question'){
			divs[no].onclick = showHideContent;
			divs[no].id = 'FDVA_q'+divCounter;
			var answer = divs[no].nextSibling;
			while(answer && answer.tagName!='DIV'){
				answer = answer.nextSibling;
			}
			answer.id = 'FDVA_a'+divCounter;
			contentDiv = answer.getElementsByTagName('DIV')[0];
			contentDiv.style.top = 0 - contentDiv.offsetHeight + 'px';
			contentDiv.className='FDVA_answer_content';
			contentDiv.id = 'FDVA_ac' + divCounter;
			answer.style.display='none';
			answer.style.height='1px';
			divCounter++;
		}
	}

}







window.onload = initShowHideDivs;





function ShowPicture(id,Source) { 
if (Source=="1"){ 
if (document.layers) document.layers[''+id+''].visibility = "show" 
else if (document.all) document.all[''+id+''].style.visibility = "visible" 
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible" 
} 
else 
if (Source=="0"){ 
if (document.layers) document.layers[''+id+''].visibility = "hide" 
else if (document.all) document.all[''+id+''].style.visibility = "hidden" 
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden" 
} 
} 





function setVisibility(objectID,state) {
	var dom = findDOM(objectID,1);
	dom.display = state; 
}







function reloadImg(id) {
   var obj = document.getElementById(id);
   var src = obj.src;
   var pos = src.indexOf('?');
   if (pos >= 0) {
      src = src.substr(0, pos);
   }
   var date = new Date();
   obj.src = src + '?v=' + date.getTime();
   return false;
} 




function validateForm()
{
var x=document.forms["thenews"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Not a valid e-mail address");
  return false;
  }
}


