﻿// JScript File
// window to open a TVC popup
function openDocument(url)
{
    if (confirm('This will download the file. Do you want to continue?')) 
    {
      //  popup(url,"console","800","600");
	    var tvcWin = window.open(url,'TVC','toolbar=no,width=800,height=600,top=300,left=450,status=yes, scrollbars=yes,resizeable=yes'); 
	    tvcWin.focus();
	}
}

function leavingWarning()
{      
   // confirm("You are now leaving this web site"); 
} 

function submitSearch(e)
{		if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
			e.returnValue=false;
			e.cancel = true;
			document.getElementById("ctl00_ctl00_contentMain_plcMain_ucSearchContainer_CMSSearchDialog1_btnSearch").click();
			}
}

function submitTopSearch(e)
{

  if (e.keyCode == 13)  //return /enter key
  {
     var submitSearch = document.getElementById('ctl00_ctl00_btnImgSearch');
     submitSearch.click();

 }
}
  
  
function addAlerts(url)
{ 
    // bit hacky needs reg ex in here
    var hostvalue;

    hostvalue = url.split('/')[0];
    if(hostvalue == 'http:')
    {
        if(url != "http://www.austadmin.com.au/")
        { 
              if(confirm("Warning: When you click on this link, you will leave the REST website. REST's Privacy Policy and Terms of Use will no longer apply. REST encourages individuals to read the privacy statements, disclaimers and terms of use of any new websites that they visit. REST is not liable for the views or actions of any organisation whose website is accessible via links from REST's website"))
              {
                    window.open(url);
                   // window.location = url;
              }
              else{
                return false;
              }
        } 
    }
    else{
        window.location = url;
    }
      
  } 
  
function increaseFontSize() 
{
    setCookie('currentFontSize','largeFontSize',null,'/',null,null);
    document.getElementById('page-wrapper').style.fontSize = '120%';
//	if(!document.getElementById('page-wrapper').style.fontSize){
//		document.getElementById('page-wrapper').style.fontSize = '120%';
//		}
//	} else {
//		var str_fontsize = document.getElementById('page-wrapper').style.fontSize;
//		var num_fontsize = str_fontsize.substring(0,str_fontsize.length-1);
//		
//		if(num_fontsize <= 120)
//		{
//		var num_newsize = num_fontsize * 1.1;
//		document.getElementById('page-wrapper').style.fontSize = num_newsize + '%';
//		}
//		
//		if(num_fontsize < 100)
//		{
//		    document.getElementById('page-wrapper').style.fontSize = '100%';
//		}
//	}
}

function decreaseFontSize()
{
    setCookie('currentFontSize','defaultFontSize',null,'/',null,null);
    document.getElementById('page-wrapper').style.fontSize = '100%';

//	if(!document.getElementById('page-wrapper').style.fontSize){
//		document.getElementById('page-wrapper').style.fontSize = '100%';
//	} 
//	else {
//		var str_fontsize = document.getElementById('page-wrapper').style.fontSize;
//		var num_fontsize = str_fontsize.substring(0,str_fontsize.length-1);
		
//		if(num_fontsize >= 90)
//		{
//		    var num_newsize = num_fontsize * 0.9;
//		    document.getElementById('page-wrapper').style.fontSize = num_newsize + '%';
//		}
		
//		if(num_fontsize > 100)
//		{
//		    document.getElementById('page-wrapper').style.fontSize = '100%';
//		}
//	}
}

function showImage(imageName)
{
    var image = document.getElementsByTagName(imageName);
    image.visible = 'true';
    
    alert(image.visible);
}
