
//*****************************************************
// Billion
//*****************************************************
function billion(strIn, x){
	s = "";
	for(i=x; i>=1; i--){
		if(i > 1){
			s = s + "<img src='http://www.thenewslink.com/images/spacer.jpg'>";
		}else{
			s = s + "<img src='http://www.thenewslink.com/images/45px.jpg'>";
		}
	}
	return strIn + " " + s + " $" +  x + " Billion";
}

//*****************************************************
// Expandable YouTube videos
//*****************************************************
var expanded = 0;
function normalPlayer(plusMinusDiv, divTag, id__, width, height) {
	if(expanded == 0){
		//resizePlayer(0, 0);
		//document.getElementById("plusMinusDiv").innerHTML="";
		document.getElementById(plusMinusDiv).innerHTML="<img border='0' src='http://www.thenewslink.com/images/minus.png'>";
		document.getElementById(divTag).innerHTML= '<object width="' +  width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + '&hl=en_US&fs=1&rel=0&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'  + id__ +    '&hl=en_US&fs=1&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '"></embed></object>';
		expanded = 1;
	}else{
		//resizePlayer(0, 0);
		//document.getElementById("showVid").innerHTML="";
		document.getElementById(plusMinusDiv).innerHTML="<img border='0' src='http://www.thenewslink.com/images/plus.png'>";
		document.getElementById(divTag).innerHTML= "";        
		expanded = 0;		
	}
} //End Expandable YouTube Videos

/***********************************************
************************************************
* HTML Slideshow
* !!! READ FIRST !!!
* There are four things that need to be changed to use this script (they are all in the *body* of the HTML).
*    1) The array elements needs to be changed with the desired data.
*    2) setLength() must be the size of the array (i.e., the number of elements in the slideshow).
*    3) The quanitity of anchor tags (Note: nothing needs to be changed; just use the proper quantity of anchor tags).
*    4) Set the original content of both div tags.
************************************************
************************************************/

/***********************************************
* Initiate global variables and set up the 2-D array.
*    Note: The array is currently set up to only hold 100 slides!!!
************************************************/
var data = new Array();
for(i=0;i<100;i++){
   data[i] = new Array();
}
var current = 0;
var listLength;

/***********************************************
* This must be set every time the script is used...
*   in the *body* of the page.
************************************************/
function setLength(x){
	listLength = x;
}
	
/***********************************************
* This will dump everything in the 2-D array 
*    into the div tag.
************************************************/	
function sendEverythingToDiv(){
   //print
   var s = '';
   for(i=0;i<listLength;i++){
    for(j=0;j<2;j++){
        s += data[i][j] + ' ';
    }
    s = s + '<br>';
	}
	document.getElementById('fred').innerHTML = s;
}

/***********************************************
* Moves slideshow up.
************************************************/	
function up(){
	if (current < listLength-1){
		document.getElementById(current).style.backgroundColor = 'white';
		current++;
		document.getElementById('barney').innerHTML = data[current][0];
		document.getElementById('fred').innerHTML = data[current][1];	
		document.getElementById(current).style.backgroundColor = 'yellow';
	}
	else{
		document.getElementById(current).style.backgroundColor = 'white';
		current = 0;
		document.getElementById('barney').innerHTML = data[current][0];
		document.getElementById('fred').innerHTML = data[current][1];	
		document.getElementById(current).style.backgroundColor = 'yellow';
	}
}

/***********************************************
* Moves slideshow down.
************************************************/	
function down(){
	if (current > 0){
		document.getElementById(current).style.backgroundColor = 'white';
		current--;
		document.getElementById('barney').innerHTML = data[current][0];
		document.getElementById('fred').innerHTML = data[current][1];	
		document.getElementById(current).style.backgroundColor = 'yellow';
	}
	else{
		document.getElementById(current).style.backgroundColor = 'white';
		current = listLength-1;
		document.getElementById('barney').innerHTML = data[current][0];
		document.getElementById('fred').innerHTML = data[current][1];
		document.getElementById(current).style.backgroundColor = 'yellow';
	}
}

/***********************************************
* Gives user the option of clicking on 
*    an anchor tag to move to a particular slide.
************************************************/
function sendToDiv(x){
	document.getElementById('barney').innerHTML = data[x][0];
	document.getElementById('fred').innerHTML = data[x][1];
	document.getElementById(current).style.backgroundColor = 'white';
	current = x;
	document.getElementById(current).style.backgroundColor = 'yellow';
}


/***********************************************
************************************************
* Break out of iframes
************************************************
************************************************/
if (top.location != self.location) top.location = self.location;


/***********************************************
************************************************
* Place stuff into a div
* parameters:
*   -content
*   -div
************************************************
************************************************/
function putStuffInDiv(contents, div){
	document.getElementById(div).innerHTML = contents;
}


/***********************************************
************************************************
* Place video into a div
* parameters:
*   -divTag: self explanatory
*   -id__: the YouTube id. (It is easy to get this from URL of video)
*   -width: self exlanatory.  (This can be taken from .embed code').
*   -height: self exlanatory.  (This can be taken from .embed code').
*   -start: You can choose a start time in seconds or just set it to zero. 
*************************************************
************************************************/
function putVideoInDiv(divTag, id__, width, height, start) {
   document.getElementById(divTag).innerHTML= '<object width="' +  width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' +  id__  +            '&hl=en_US&fs=1&rel=0&autoplay=1' + '&start=' + start + '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'  + id__ +    '&hl=en_US&fs=1&rel=0&autoplay=1'         + '&start=' + start  +     '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '"></embed></object>';
}

/***********************************************
************************************************
* Place image into a div
* parameters:
*   -content
*   -div
************************************************
************************************************/
function putImageInDiv(URL, div){
	document.getElementById(div).innerHTML = '<img src=\'' + URL + '\'>';
}




