function setValues(no){
    var path = window.location.pathname;
    //var name = path.substring(1);
    var name=path.substring(path.lastIndexOf('/') + 1);
    //alert(name);
        if (name=='Articles.aspx')
        {
            window.document.getElementById('Articles.aspx').style.background="#FBFBFD url(images/button_back.png) repeat-x 0px 0px";
	        window.document.getElementById('Articles.aspx').style.color="#ffffff";
        }
        else {
	        window.document.getElementById(name).style.background="#FBFBFD url(images/button_back.png) repeat-x 0px 0px";
	        window.document.getElementById(name).style.color="#ffffff";
	    }
	//////////////////////////////
	if (name=="pictures.aspx"){
	    fixImgs('pictureDiv',500);
	}
	ajaxFunction_new('ScheduledActivities.aspx')
}

//var qs = new Querystring()
//var cid=qs.get('CID',0);

function feedback(id,evnt){
	if (evnt == 'over'){window.document.getElementById(id).style.background="url(images/feedback.jpg) no-repeat 0px 0px";
	}else{window.document.getElementById(id).style.background="url(images/feedback.jpg) no-repeat -3px 0px";}
}

function changePostButton(id){
	window.document.getElementById(id).style.backgroundColor="#990000";
	window.document.getElementById(id).style.color="#ffffff";
}

function changeBack(id,backcolor,fcolor){
	window.document.getElementById(id).style.backgroundColor=backcolor;
	window.document.getElementById(id).style.color=fcolor;
}

function SiteRating(no){
    var id="site_rating";
    switch (no){
        case "1":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px -14px";
                break;
        case "2":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px -28px";
                break;
        case "3":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px -42px";
                break;
        case "4":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px -56px";
                break;
        case "5":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px -70px";
                break;
        default:
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 15px 0px";
    }
}


function VoteRating(no){
    var id="vote_rating";
    switch (no){
        case "1":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px -14px";
                break;
        case "2":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px -28px";
                break;
        case "3":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px -42px";
                break;
        case "4":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px -56px";
                break;
        case "5":
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px -70px";
                break;
        default:
                document.getElementById(id).style.background="url(images/rating.png) no-repeat 7px 0px";
    }
}


function innerVoteRating(no,id){
    //alert(document.getElementById(id).parentNode.parentNode.parentNode.id);
    var curid = window.document.getElementById(id).parentNode.parentNode.parentNode ;
    switch (no){
        case "1":
                curid.style.background="url(images/rating1.png) no-repeat 0px -14px";
                break;
        case "2":
                curid.style.background="url(images/rating1.png) no-repeat 0px -28px";
                break;
        case "3":
                curid.style.background="url(images/rating1.png) no-repeat 0px -42px";
                break;
        case "4":
                curid.style.background="url(images/rating1.png) no-repeat 0px -56px";
                break;
        case "5":
                curid.style.background="url(images/rating1.png) no-repeat 0px -70px";
                break;
        default:
                curid.style.background="url(images/rating1.png) no-repeat 0px 0px";
    }
}

function sendemail(){
        var url = "mailto:?subject=" + document.title + "&body=Hey,%0a%0aI thought you might be interested in this page:%0a%0a" + document.title + ".%0a%0aYou can view it at:%0a%0a" + location.href;
        document.location.href = url;
}


function displayline(id,no){
        switch (no){
        case "1":
                document.getElementById(id).style.textDecoration="underline";
                break;
         default:
                document.getElementById(id).style.textDecoration="none";
         }
}
//childNodes[2]

function CalAvgloader(id){
        var tempid = document.getElementById(id).parentNode.parentNode.parentNode.id;
        var curNo = tempid.substring(16);
        document.getElementById("avg_loader"+curNo).style.display="block";
}








function closediv(id){
        document.getElementById(id).style.display="none";
}

function loader(id){
        document.getElementById(id).style.display="block";
}

function IsEmptyValue(aid,id){
    var t_aid = document.getElementById(aid).value;
    if (t_aid!=""){
        document.getElementById(id).style.display="block";
    }else{
        alert('dddd');
    }
}

function mainloader(id){
        //alert(document.getElementById('inner_main_box').offsetHeight);
        document.getElementById(id).style.height = ((document.getElementById('inner_main_box').offsetHeight) -10) + "px";
        document.getElementById('main_load_img').style.paddingTop = "200px";
        document.getElementById(id).style.display="block";
        document.getElementById('bottom_loader1').style.paddingTop="260px";
        document.getElementById('bottom_loader1').style.display="block"; 
        document.location.href="#top";
        
}

function mainloader_menucall(id){
        document.getElementById(id).style.height = ((document.getElementById('inner_main_box').offsetHeight) -10) + "px";
        document.getElementById('main_load_img').style.paddingTop = "40px";
        document.getElementById(id).style.display="block";
        document.getElementById('bottom_loader1').style.paddingTop="100px";
        document.getElementById('bottom_loader1').style.display="block";  
}

function changeBackColor(id,backcolor){
	window.document.getElementById(id).style.backgroundColor=backcolor;
}


function fixImgs(whichId, maxW) {
var pix=document.getElementById(whichId).getElementsByTagName('img');
  for (i=0; i<pix.length; i++) {
    w=pix[i].width;
    h=pix[i].height;
    if (w > maxW) {
      f=1-((w - maxW) / w);
      pix[i].width=w * f;
      pix[i].height=h * f;
    }
  }
}

function PollValue(aid,rdoname){
    document.getElementById('ctl00_cntMainRight_AnsValue').value=aid;
     
    
    var theObj = document.getElementsByName(rdoname);
	for (var i=0; i<theObj.length; i++) {
		if (theObj[i].value==aid) {
			theObj[i].checked = true;
		}
	}
    
}


function getSubCat(){
        document.getElementById('ctl00_cntMain_ctl00_txt_subCat').value = document.getElementById('ddl_subcat').value;
    }
    
    
function CallActiveButton(id) {
switch (id) {
	case "tab1":
		document.getElementById("tab1").style.backgroundImage = "url(images/tab1_active.jpg)";
		//document.getElementById("detail_tab1").style.display = "block";
		document.getElementById("tab2").style.backgroundImage = "url(images/tab1_normal.jpg)";
		//document.getElementById("detail_tab2").style.display = "none";
	break;
	case "tab2":
		document.getElementById("tab1").style.backgroundImage = "url(images/tab2_normal.jpg)";
		//document.getElementById("detail_tab1").style.display = "none";
		document.getElementById("tab2").style.backgroundImage = "url(images/tab2_active.jpg)";
		//document.getElementById("detail_tab2").style.display = "block";
	break;
}
}



function ajaxFunction_new(page_name) {
			var xmlHttp = null;
            try
              {
              // Firefox, Opera 8.0+, Safari
              xmlHttp=new XMLHttpRequest();
              }
              
              
              
            catch (e)
              {
              // Internet Explorer
              try
                {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                }
              catch (e)
                {
                try
                  {
                  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                catch (e)
                  {
                  alert("Your browser does not support AJAX!");
                  return false;
                  }
                }
              }
              xmlHttp.onreadystatechange=function()
                {
                    if(xmlHttp.readyState==4)
                      {
                  		//$("WebForm1.aspx").html(xmlHttp.responseText);
                      }
                }
                
                var rand_no = Math.random();

                xmlHttp.open("GET", page_name, true);
                xmlHttp.send(null);
                 
}
