﻿// JScript File

        function GetClientId(strid)
        {
            var count=document.forms[0].length;
            var i=0;
            var eleName; 
            for (i=0; i < count; i++ )
            {
                eleName=document.forms[0].elements[i].id; 
                pos=eleName.indexOf(strid);
                if(pos>=0)
                {    
                    break;            
                }
            }
            return eleName;
        }
        
        function Get_Search() { 
            var help = document.getElementById(GetClientId("SearchText")); 
     
            window.location="default.aspx?q="+help.value;
          
        } 
         function Get_Language(num) { 
            var help = document.getElementById(GetClientId("lanHidden_value")); 
                help.value = num;

                if (location.href.indexOf("language")==-1)
                {
                    // not found
                    if (location.href.indexOf("default.aspx")==-1)
                    {
                        window.location="default.aspx?language="+help.value   
                    }
                    else
                    {

                        if (location.href.substring(location.href.length-12,location.href.length)=="default.aspx")
                        {
                             window.location= window.location+"?language="+help.value
                        }
                        else
                        {
                             window.location= window.location+"&language="+help.value
                        }
                    }          
                }
                else
                {
                       
                       window.location=location.href.substr(0,location.href.indexOf("language"))+"language="+help.value;
                        
                }     
 
        } 
         function Get_Vote(num) { 
            var help = document.getElementById(GetClientId("Hidden_value")); 
            if (num == "r") { 
                help.value = "r"; 
                if (location.href.indexOf("pollresult")==-1)
                {window.location=location.href +"&pollresult=true";}
                else
                {window.location=location.href}
            } 
            if (num == "v") { 
                //help.value = "v"; 
             
                 if (location.href.indexOf("pollvote")==-1)
                {window.location=location.href +"&pollvote="+help.value}
                else
                {window.location=location.href}
            }
            else
            {
                help.value = num; // assign radio button to hidden field
             } 
 
        } 
		function setSelectedArticle(task)
		{
			
			box = document.getElementById("taskID");
			//Loading1 = document.getElementById("Loading");						
			if((box != null) && clicked != true)
			{
				box.value = task;
				box.focus();
				box.blur();
				//Loading1.style.visibility="visible";
				__doPostBack('taskID','')
				
			}
		}
		
		function openPopUp(strHREF)
		{
				window.open(strHREF,"externalwindow","height=450,width=610,resizable =yes,scrollbars=yes,status=yes,toolbar=yes,menubar=yes,location=yes")
		}

		function openPopUpFirst(strHREF)
		{
				window.open(strHREF,"externalwindow1","height=400,width=400,resizable =no,scrollbars=no,status=no,toolbar=no,menubar=no,location=no")
		}
     
		
				
		function LoadFileIframe(left,top,width,height,filename)
		{
			var tempIFrame=document.createElement('iframe');
			tempIFrame.setAttribute('id','RSIFrame');
			tempIFrame.style.border='0px';
			tempIFrame.style.width=width;
			tempIFrame.style.height=height;
			tempIFrame.style.position='absolute';
			tempIFrame.style.top=top;
			tempIFrame.style.left=left;
			tempIFrame.src=filename;
			IFrameObj = document.body.appendChild(tempIFrame);

		}		
				
		function adjustIFrameSize (iframeWindow) 
		{
			if (iframeWindow.document.height) 
			{
				var iframeElement = parent.document.getElementById(iframeWindow.name);
				iframeElement.style.height = iframeWindow.document.height + 'px';
				iframeElement.style.width = iframeWindow.document.width + 'px';
			}
			else 
			if (document.all) 
			{
			    var iframeElement = parent.document.all[iframeWindow.name];
			    if (iframeWindow.document.compatMode &&	iframeWindow.document.compatMode != 'BackCompat') 
			    {
				iframeElement.style.height = iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
				iframeElement.style.width = iframeWindow.document.documentElement.scrollWidth + 5 + 'px';
			    }
			    else 
			    {
				iframeElement.style.height =iframeWindow.document.body.scrollHeight + 5 + 'px';
				iframeElement.style.width = iframeWindow.document.body.scrollWidth + 5 + 'px';
			    }
		     }
		 }
								
					
		function sizeIframe()
		{
			winHeight = document.body.clientHeight;
			winWidth = document.body.clientWidth;
			winHeight = winHeight - 71;
			//winHeight = winHeight - 40;
			//document.write(winHeight);
			if (winHeight > 0)
			{
			 //document.all.content.style.height = winHeight;
			
			 if(document.layers)
			 {  
              			document.layer1.top = winHeight+document.body.scrollTop ;
			  	document.layer2.top = winHeight+document.body.scrollTop+46 ;
			 }

			 
			 if(document.all!=null)
			 {
			  
			  layer1.style.top = winHeight+document.body.scrollTop ;	
			  layer2.style.top = winHeight+document.body.scrollTop+46 ;
			 
			  //layer1.style.width = document.body.scrollWidth;//winWidth;//document.body.scrollWidth ;	
			  if (winWidth<760)
			  {
			   layer1.style.width=760;
			   layer2.style.width=760;
			  }
			  else
			  {
			   layer1.style.width=winWidth;
			   layer2.style.width=winWidth;
			  }
			  // alert(layer1.style.width);
			  //layer2.style.width = document.body.scrollWidth ;
			 }
			 
			
			}// winheight>0
		}
		

	
