
function navFromSelect(oSel) {
	val = oSel.options[oSel.selectedIndex].value;
	alert(val);
}

function TogglePanel(id)
{
	var el = document.getElementById(id); 
	if(el != null)
	{
		if ( el.style.display != "none" ) 
		{   
			el.style.display = 'none'; 
		}  
		else
		{   
			el.style.display = '';  
		}
	}
}

function TogglePanelByCheckbox(panelid, checkboxid)
{
	var panel = document.getElementById(panelid); 
	var checkbox = document.getElementById(checkboxid); 
	if(panel != null && checkbox !=null)
	{
		if ( checkbox.checked ) 
		{   
			panel.style.display = ''; 
		}  
		else
		{   
			panel.style.display = 'none';  
		}
	}
}


function viewMessage(messageId) {
	var width=440;
	var height=515;
	var top = new Number((screen.availHeight/2)-(height/2));	
	var left = new Number((screen.availWidth/2)-(width/2));				
	var args="width=" + width +",height=" + height +",top=" + top +", left=" + left +",resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no";
	oWindow = window.open("viewForumMessage.aspx?messageId=" + messageId, "viewForumMessage", args);
	oWindow.focus();
}

function viewSurvey (id)
{
	var width=800;
	var height=500;
	var top = new Number((screen.availHeight/2)-(height/2));	
	var left = new Number((screen.availWidth/2)-(width/2));				
	var args="width=" + width +",height=" + height +",top=" + top +", left=" + left +",resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no";
	oWindow = window.open("viewSurveyStandalone.aspx?id=" + id, "viewSurvey", args);
	oWindow.focus();
}

function openPrivacyStatement()
{			
	var height=500;
	var width=520;
	var top=0;
	var left=0;
	var args="width=" + width +",height=" + height +",top=" + top +", left=" + left +",resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no";			
	oWindow = window.open("privacyStatement.htm", "PrivacyStatement", args);
	oWindow.focus();
}


function showSurvey(id)
{
	document.location.href = "viewSurvey.aspx?id=" + id;
}

/*
*This function is used to open the terms and condition in
* a new window. If javascript is enabled in the browser this
* function will be called in the onclick event of the link.
* If it is disabled page will be opened based on the href
* element of the anchor tag.
*/
function openTermsCondition(link)
{     
	var args="width=520,height=500,top=0, left=0,resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no";               
	oWindow = window.open(link.href,link.target,args);
	oWindow.focus();
}


function openSendWindow(contentId)
{						
	var oWindow=' ';
	var height=500;
	var width=520;
	var top=0;
	var left=0;
	var args="width=" + width +",height=" + height +",top=" + top +", left=" + left +",resizable=yes,toolbar=no,menubar=no,scrollbars=yes,status=no";																		
	if(!oWindow.open)
	{
	oWindow = window.open("send.aspx?contentId="+contentId, "sendWindow", args);					
	oWindow.focus();					
	}
}

var printWin;

function printArticle(contentId)
{						
	var oWindow=' ';
	var height=580;
	var width=630;
	var top=0;
	var left=0;
	//var args="width=" + width +",height=" + height +",top=" + top +", left=" + left +",resizable=yes,toolbar=no,menubar=yes,scrollbars=yes,status=no";																		
//	if(!oWindow.open)
//	{
//		oWindow = window.open("printArticle.aspx?contentId="+contentId, "sendWindow", args);					
//		oWindow.focus();					
//	}
    printWin = window.open("","IPRN","width=10,height=10");
    var html;
    html= '<HTML>\n<HEAD>\n';
    if (document.getElementsByTagName != null)
    {
        var headTags = document.getElementsByTagName("head");
        if (headTags.length > 0)
        html += headTags[0].innerHTML;
        
    }
    
    html += '\n</HEAD>\n<BODY>\n';
    html +='<div class="wrapper">';
    html += document.getElementById("printDetail").innerHTML
    html +='</div>';
    html += '\n</BODY>\n</HTML>';
    printWin.document.open();
    printWin.document.write(html);
    printWin.location.reload(); 
    pausecomp(500);
    //printWin.window.print();
    //setTimeout("ClodePrintWin()",500);
}

function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while(curDate-date < millis);
} 

function ClodePrintWin()
{
    printWin.close();
}

function enter(event) 
{		
	// for IE, e.keyCode or window.event.keyCode can be used									
	if(window.event && window.event.keyCode == 13) {						
		submitForm();
	}
	else if(event && event.which == 13) {
		// netscape						
		submitForm();
	}
	else
	{						
		return false;						
	}							
}		

/* Function used to Clear the search box text */			
function ClearTextBox(element,value)
{
    if(element.value==value)
        element.value="";
}

 //**********************************************************************************************	
//Ticker specific methods			
//**********************************************************************************************
 function SetPrevious()
 {
    if(index == 0)
        index=idArray.length -2;
    else    
        index = index-2
    CreateAnchors();
 } 
 
 function StopTicker(start,stop)
 {
    clearTimeout(timer);
    isStopped = 1;
    document.getElementById(stop).style.display='none';
    document.getElementById(start).style.display='inline';
 }
 function StartTicker(start,stop)
 {
    isStopped = 0;
    CreateAnchors()
    document.getElementById(stop).style.display='inline';
    document.getElementById(start).style.display='none';
 }