﻿// JScript File
function goSearch()
{
    if(document.aspnetForm.TextBox1.value == "")
    {
        alert("You must enter a search term.");
    }
    else
    {
    
         window.location = "/search.aspx?search=" + document.aspnetForm.TextBox1.value;
    }
}

var tags = new Array( 'span','div','td','tr','p','b','table','strong','emphasis','a','h1','h2','h3','pre','sub','sup','i','th','cp','ul','ol','li','dt','dd');
var sizeArray =  new Array('xx-small', 'x-small', 'small', 'medium', 'large', 'x-large');
var initSize = 3;
var defaultSize=3;

function fontSizer(inc)
{
    if (!document.getElementById) 
        return;
    var size = initSize;
    if (inc!=0)
    {
        size=size+inc;
        if (size < 0 )
            size = 0;
        if (size > 5 )
            size = 5;
        initSize = size;
    }
    else
        initSize=defaultSize;

    myDIV=document.getElementById('DivContent');
    for (i = 0 ; i < tags.length ; i++ )
    {
        getallTags = myDIV.getElementsByTagName(tags[i]);
        for (k = 0 ; k < getallTags.length ; k++) 
            getallTags[k].style.fontSize = sizeArray[size];
    }
    return false;
}


    function RecordClick(pageid)
    {
       //callserver(pageid, 'page');
    }


    function openWindow(id)
    {
        if (id.length>0)
            window.open('/content/id/' + id + '.html?print=true');
        else
            window.print();
    }

function CreateXmlHttp()
{
	//Creating object of XMLHTTP in IE
	try
	{
		XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlHttp = null;
		}
	}
	//Creating object of XMLHTTP in Mozilla and Safari 
	if(!XmlHttp && typeof XMLHttpRequest != "undefined") 
	{
		XmlHttp = new XMLHttpRequest();
	}
}


function callserver(value, mode) 
{

	if(mode == "font"){
	    //var requestUrl = "/ajax.aspx?font=" + value;
	}
	if(mode == "page"){
	    //var requestUrl = "/ajax.aspx?pageid=" + value;
	}
	CreateXmlHttp();
	// If browser supports XMLHTTPRequest object
	
	if(XmlHttp)
	{
		//Initializes the request object with GET (METHOD of posting), 
		//Request URL and sets the request as asynchronous.
		XmlHttp.open("GET", requestUrl,  true);
		//Sends the request to server
		XmlHttp.send(null);	
		
	}
}

function switchSurvey(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function HideSurvey(obj) {
	var el = document.getElementById(obj);
	el.style.display = '';
}
