var ajax1 = new sack();
var articleListObj1;
var activeArticle1 = false;
var clickedArticle1 = false;
var contentObj1	// Reference to article content <div>

var ajax2 = new sack();
var articleListObj2;
var activeArticle2 = false;
var clickedArticle2 = false;
var contentObj2	// Reference to article content <div>


var ajax3 = new sack();
var articleListObj3;
var activeArticle3 = false;
var clickedArticle3 = false;
var contentObj3	// Reference to article content <div>


function init_dw_Scroll1() {
    /* 1 */
	var wndo = new dw_scrollObj('wn', 'lyr1');
    wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
    wndo.setUpScrollControls('scrollbar',true, 'v');

    var wndo = new dw_scrollObj('wnV', 'lyr1V');
	wndo.setUpScrollControls('scrollLinks', true, 'v');
	
}

function init_dw_Scroll2() {
    var wndo = new dw_scrollObj('wn2', 'lyr2');
    wndo.setUpScrollbar("dragBar2", "track2", "v", 1, 1);
    wndo.setUpScrollControls('scrollbar2',true, 'v');

    var wndo = new dw_scrollObj('wnV2', 'lyr2V');
	wndo.setUpScrollControls('scrollLinks2', true, 'v');
}

function init_dw_Scroll3() {
    var wndo = new dw_scrollObj('wn3', 'lyr3');
    wndo.setUpScrollbar("dragBar3", "track3", "v", 1, 1);
    wndo.setUpScrollControls('scrollbar3',true, 'v');

    var wndo = new dw_scrollObj('wnV3', 'lyr3V');
	wndo.setUpScrollControls('scrollLinks3', true, 'v');
}

// if code supported, link in the style sheet and call the init function onload
if ( dw_scrollObj.isSupported() ) {
    //dw_writeStyleSheet('css/scrollbar_demo.css')
    //dw_scrollObj.printEnabled = true;
    dw_Event.add( window, 'load', init_dw_Scroll1);    
    dw_Event.add( window, 'load', init_dw_Scroll2);    
    dw_Event.add( window, 'load', init_dw_Scroll3);    
}


////NO NEED TO EDIT BELOW THIS LINE////////////

//DF START//


function mouseoverArticle1()	// Highlight article
{
	if(this==clickedArticle1)return;
	if(activeArticle1 && activeArticle1!=this){
		if(activeArticle1==clickedArticle1)
			activeArticle1.className='articleClick';
		else
			activeArticle1.className='';

	}
	this.className='articleMouseOver';
	activeArticle1 = this;	// Storing reference to this article
}

function mouseoverArticle2()	// Highlight article
{
	if(this==clickedArticle2)return;
	if(activeArticle2 && activeArticle2!=this){
		if(activeArticle2==clickedArticle2)
			activeArticle2.className='articleClick';
		else
			activeArticle2.className='';

	}
	this.className='articleMouseOver';
	activeArticle2 = this;	// Storing reference to this article
}

function mouseoverArticle3()	// Highlight article
{
	if(this==clickedArticle3)return;
	if(activeArticle3 && activeArticle3!=this){
		if(activeArticle3==clickedArticle3)
			activeArticle3.className='articleClick';
		else
			activeArticle3.className='';

	}
	this.className='articleMouseOver';
	activeArticle3 = this;	// Storing reference to this article
}


function showContent1()	// Displaying content in the content <div>
{
      contentObj1.innerHTML = ajax1.response;	// ajax.response is a variable that contains the content of the external file
      dw_scrollObj.loadLayer('wnV','lyr1V');
      initLightbox();
}

function showContent2()	// Displaying content in the content <div>
{
      contentObj2.innerHTML = ajax2.response;	// ajax.response is a variable that contains the content of the external file
      dw_scrollObj.loadLayer('wnV2','lyr2V');
      initLightbox();
}

function showContent3()	// Displaying content in the content <div>
{
      contentObj3.innerHTML = ajax3.response;	// ajax.response is a variable that contains the content of the external file
      dw_scrollObj.loadLayer('wnV3','lyr3V');
      initLightbox();
}


dw_scrollObj.loadLayer = function(wndoId, lyrId, horizId) {
    if ( dw_scrollObj.col[wndoId] ) dw_scrollObj.col[wndoId].load(lyrId, horizId);
}

function showWaitMessage1()
{
	contentObj1.innerHTML = 'Finding article.....<br>Please wait';
}

function showWaitMessage2()
{
	contentObj2.innerHTML = 'Finding article.....<br>Please wait';
}

function showWaitMessage3()
{
	contentObj3.innerHTML = 'Finding article.....<br>Please wait';
}


function getAjaxFile1(fileName)
{
    ajax1.requestFile = fileName;	// Specifying which file to get
	ajax1.onCompletion = showContent1;	// Specify function that will be executed after file has been found
	ajax1.onLoading = showWaitMessage1;	// Action when AJAX is loading the file
	ajax1.runAJAX();		// Execute AJAX function
}

function getAjaxFile2(fileName)
{
    ajax2.requestFile = fileName;	// Specifying which file to get
	ajax2.onCompletion = showContent2;	// Specify function that will be executed after file has been found
	ajax2.onLoading = showWaitMessage2;	// Action when AJAX is loading the file
	ajax2.runAJAX();		// Execute AJAX function
}


function getAjaxFile3(fileName)
{
    ajax3.requestFile = fileName;	// Specifying which file to get
	ajax3.onCompletion = showContent3;	// Specify function that will be executed after file has been found
	ajax3.onLoading = showWaitMessage3;	// Action when AJAX is loading the file
	ajax3.runAJAX();		// Execute AJAX function
}

function selectArticle1()	// User have clicked on an article
{
	getAjaxFile1('newsgallery/'+ this.id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	if(clickedArticle1 && clickedArticle1!=this)clickedArticle1.className='articleMouseOver';
	this.className='articleClick';
	clickedArticle1 = this;
}

function selectArticle2()	// User have clicked on an article
{
	getAjaxFile2('newsgallery/'+ this.id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	if(clickedArticle2 && clickedArticle2!=this)clickedArticle2.className='articleMouseOver';
	this.className='articleClick';
	clickedArticle2 = this;
}

function selectArticle3()	// User have clicked on an article
{
	getAjaxFile3('newsgallery/'+ this.id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	if(clickedArticle3 && clickedArticle3!=this)clickedArticle3.className='articleMouseOver';
	this.className='articleClick';
	clickedArticle3 = this;
}

function initAjaxDemo()
{
	/* 1 */
	contentObj1 = document.getElementById('lyr1V');
	articleListObj1 = document.getElementById('articleList');
	var articles = articleListObj1.getElementsByTagName('LI');
	for(var no=0;no<articles.length;no++){
		articles[no].onmouseover = mouseoverArticle1;
		articles[no].onclick = selectArticle1;
	}

	getAjaxFile1('newsgallery/'+ articles[0].id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	articles[0].className='articleClick';
	clickedArticle1 = articles[0];
	
	/* 2 */ 
	contentObj2 = document.getElementById('lyr2V');
	articleListObj2 = document.getElementById('articleList2');
	var articles2 = articleListObj2.getElementsByTagName('LI');	
	for(var no=0;no<articles2.length;no++){
		articles2[no].onmouseover = mouseoverArticle2;
		articles2[no].onclick = selectArticle2;
	}

	getAjaxFile2('newsgallery/'+ articles2[0].id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	articles2[0].className='articleClick';
	clickedArticle2 = articles2[0];


	/* 3 */ 
	contentObj3 = document.getElementById('lyr3V');
	articleListObj3 = document.getElementById('articleList3');
	var articles3 = articleListObj3.getElementsByTagName('LI');	
	for(var no=0;no<articles3.length;no++){
		articles3[no].onmouseover = mouseoverArticle3;
		articles3[no].onclick = selectArticle3;
	}

	getAjaxFile3('newsgallery/'+ articles3[0].id + '.html');	// Calling the getAjasFile function. argument to the function is id of this <li> + '.html', example "article1.html"
	articles3[0].className='articleClick';
	clickedArticle3 = articles3[0];

}
//DF END///
