﻿// JScript File

var min=8;
var max=28;
//Function for increasing the font size
function increaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=max) {
         s += 1;
      }
      p[i].style.fontSize = s+"px"
   }
}

//Function for decreasing the font size
function decreaseFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 10;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }   
}

//Function for restore the font size
function restoreFontSize() {
   var p = document.getElementsByTagName('p');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 13;
      }
      if(s!=max) {
         s = 13;
      }
      p[i].style.fontSize = s+"px"
   }
}


function changeBG()
{
var c=document.bgColor;
//var a=#ffffff;
//var b=#cccccc;
//if(c==a)
alert(c);

document.bgColor="#333333";
document.fgColor="#ffff40";
document.linkColor="#ffff40";
document.vlinkColor="#ffff40";
document.alinkColor="#ffff40";
document.getElementByTagName('p').style.color="#ffff40";
//else
//document.bgColoor="#ffffff";

}

//Function for What's New Scroll
function makeItMove(containerId,userActionId,textItemId,i)
{
// Values used by the script.
// BEWARE : YOU WILL HAVE TO MODIFIE THESE VALUES IN THE HTML CODE AS WELL, SETTING THEM TO THEIR NUMERIC VALUES!
var startValue=-60;// The value the movement will start. Must be big enough to let some white space.
var endValue=120; // the value the movement will end. Must be big enough to let the whoile text disappear
var stopValue=130; // Must be greater than endValue;
//
var containerPositionFromTop=201;
var containerPositionFromLeft=35;
var containerWidth=232;
var containerHeight=132;
//
if (document.getElementById)
    {

    if(!document.getElementById('userAction'))
        {
        //alert("No action");

        }
    else
        {
        document.getElementById(userActionId).style.visibility="visible";
        document.getElementById(userActionId).style.display="block";
        document.getElementById(userActionId).style.zIndex="15";
        document.getElementById(userActionId).style.position="relative";
        document.getElementById(userActionId).style.top="-3px";
        document.getElementById(userActionId).style.left="0px";
        document.getElementById(userActionId).style.width="auto";
        document.getElementById(userActionId).style.height="auto";
        }
			
    document.getElementById(containerId).style.zIndex="11";
    document.getElementById(containerId).style.position="relative";
    document.getElementById(containerId).style.height=containerHeight+"px";
    document.getElementById(containerId).style.overflow="hidden";

    document.getElementById(textItemId).style.zIndex="11";
    document.getElementById(textItemId).style.position="relative";
    document.getElementById(textItemId).style.top=-i+"px";
    }
if(i<endValue)
    {
    i++;

    timer=setTimeout("makeItMove('"+containerId+"','"+userActionId+"','"+textItemId+"',"+i+")",50);
    }
else
    if(i==endValue)
        {
        i=startValue;
        timer=setTimeout("makeItMove('"+containerId+"','"+userActionId+"','"+textItemId+"',"+i+")",100);
        }
     else
        {
        clearTimeout(timer);
        document.getElementById(textItemId).style.zIndex="11";
        document.getElementById(textItemId).style.position="relative";
        document.getElementById(textItemId).style.top=10+"px";
        document.getElementById(textItemId).style.left=0+"px";
        document.getElementById(containerId).style.overflow="scroll";
        }
}

function getPrint(print_area)
		{	
			//Creating new page
			var pp = window.open();
			//Adding HTML opening tag with <HEAD> … </HEAD> portion 
			pp.document.writeln('<HTML><HEAD><title>Print Preview</title><LINK href=Styles.css  type="text/css" rel="stylesheet">')
			pp.document.writeln('<LINK href=PrintStyle.css  type="text/css" rel="stylesheet" media="print"><base target="_self"></HEAD>')
			//Adding Body Tag
			pp.document.writeln('<body MS_POSITIONING="GridLayout" bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">');
			//Adding form Tag
			pp.document.writeln('<form  method="post">');
			//Creating two buttons Print and Close within a table
			pp.document.writeln('<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right><INPUT ID="PRINT" type="button" value="Print" onclick="javascript:location.reload(true);window.print();"><INPUT ID="CLOSE" type="button" value="Close" onclick="window.close();"></TD></TR><TR><TD></TD></TR></TABLE>');
			//Writing print area of the calling page
			pp.document.writeln(document.getElementById(print_area).innerHTML);
			//Ending Tag of </form>, </body> and </HTML>
			pp.document.writeln('</form></body></HTML>');			
			
		}	
		
function printContent(id){
str=document.getElementById(id).innerHTML
newwin=window.open('','printwin','left=100,top=100,width=600,height=500')
newwin.document.write('<HTML>\n<HEAD>\n')
newwin.document.write('<TITLE>Print Page</TITLE>\n')
newwin.document.write('<link href="../css/StyleSheet.css" rel="stylesheet" type="text/css" />')
newwin.document.write('<link href="css/StyleSheet.css" rel="stylesheet" type="text/css" />')
newwin.document.write('<script>\n')
newwin.document.write('function chkstate(){\n')
newwin.document.write('if(document.readyState=="complete"){\n')
newwin.document.write('window.close()\n')
newwin.document.write('}\n')
newwin.document.write('else{\n')
newwin.document.write('setTimeout("chkstate()",2000)\n')
newwin.document.write('}\n')
newwin.document.write('}\n')
newwin.document.write('function print_win(){\n')
newwin.document.write('window.print();\n')
newwin.document.write('chkstate();\n')
newwin.document.write('}\n')
newwin.document.write('<\/script>\n')
newwin.document.write('</HEAD>\n')
newwin.document.write('<BODY onload="print_win()">\n')
newwin.document.write(str)
newwin.document.write('</BODY>\n')
newwin.document.write('</HTML>\n')
newwin.document.close()
}
	
