





function sethtml(div,content) {
         var search = content;
         var script;
         
         var is_singleq = 0; var singleq = "'";
         var is_doubleq = 0; var doubleq = '"';
         var is_escaped = 0; var escap = "\\";
         var layer = 0;
               
         while( script = search.match(/(<script[^>]+javascript[^>]+>\s*(<!--)?)/)) {
            search = search.substr(search.indexOf(RegExp.$1) + RegExp.$1.length);
            if (!(endscript = search.match(/((-->)?\s*<\/script>)/))) break;
            block = search.substr(0, search.indexOf(RegExp.$1));
            search = search.substring(block.length + RegExp.$1.length);
            
            while(func = block.match(/(function(.+?)\((.*?)\)\s*\{)/)) {
               eval(block.substr(0,block.indexOf(RegExp.$1)));
               // for evaluating non functions
               
               block = block.substr(block.indexOf(RegExp.$1) + RegExp.$1.length);
               name = RegExp.$2;
               param = RegExp.$3;
               
               is_singleq = 0;
               is_doubleq = 0;
               is_escaped = 0;
               layer = 0;
               
               
               for(i=0;i<block.length;i++) {
                  c = block.substr(i,1);
                  
                  if ((is_singleq || is_doubleq) && is_escaped) {
                     is_escaped = 0;
                  } else if (!is_doubleq && (c==singleq)) {
                     is_singleq = !is_singleq;
                  } else if (!is_singleq && (c==doubleq)) {
                     is_doubleq = !is_doubleq;
                  } else if ((is_singleq || is_doubleq) && (c==escap)) {
                     is_escaped = 1;
                  } else if ( c=="{") {
                     layer++;
                  } else if ( c=="}") {
                     if ( layer==0 ) {
                        break;
                     }
                     layer--;
                  }
               }
               
               code = block.substr(0,i-1);
               block = block.substr(i +1);
               
               code = code.replace(/\n/g, '\\n');
               code = code.replace(/\r/g, '\\r');
               code = code.replace(/'/g,"\\'");
               
               eval(name + " = new Function('"+param+"','"+code+"');");
            }
            eval(block); // for evaluating non functions
         }
         document.getElementById(div).innerHTML=content;
      } 









	function httpRequest(url, id)
	{
	    
	    var httpObj = false;
	    if (typeof XMLHttpRequest != 'undefined') 
	    {
	        httpObj = new XMLHttpRequest();
	    } 
	    else if (window.ActiveXObject) 
	    {
	        try
	        {
	            httpObj = new ActiveXObject('Msxml2.XMLHTTP');
	        }
	        catch(e) 
	        {
	            try
	            {
	                httpObj = new ActiveXObject('iMicrosoft.XMLHTTP');
	            }
	            catch(e)
	            {}
	        }
	    }
	    if (!httpObj) 
	    	return;
	
	    httpObj.onreadystatechange = function() 
	    {
	    	if (httpObj.readyState == 4) 
	        { // when request is complete
	            fillSelect(httpObj.responseText,id);
	        }
	    };
	    
	    try
	    {
	    	httpObj.open('POST', url, true);
	    	httpObj.send(null);
	    }
	    catch(e)
	    {
	    	
	    }
	}
	
	function fillSelect(text,id)
	{
	   
		var sectorId=id;
		   
		   
		//var TextDiv = document.getElementById(id);
		// alert("TextDiv------"+TextDiv);

		// companyId.innerHtml = text;
		 
		//// document.getElementById("companyDetails").innerHTML = text;
		var graph = new BAR_GRAPH("hBar");
		
		sethtml("sectorDetails", text);

		graph_values = get_graph_values();
		graph_labels = get_graph_labels();

		graph.values = graph_values;
		graph.labels = graph_labels;
		graph.showValues = 2;
		graph.titles="Company,Score,Score Graph";
		graph.barWidth = 20;
		graph.barLength = 1;
		graph.labelSize = 12;
		graph.absValuesSize = 12;
		graph.percValuesSize = 12;
		graph.graphPadding = 10;
		graph.graphBGColor = "#EFEFEF";
		graph.graphBorder = "1px  solid #A0C3D5";
		graph.barColors = "#AB2C23";
		graph.barBGColor = "#FAFAFA";
		graph.barBorder = "2px outset white";
		graph.labelColor = "#0E68B7";
		graph.labelBGColor = "#CBEAFC";
		graph.labelBorder = "2px groove white";
		graph.absValuesColor = "#000000";
		graph.absValuesBGColor = "#EFEFEF";
		graph.absValuesBorder = "2px groove white";
		

			
		//document.write(graph.create());
			
		sethtml("sectorDetails1", graph.create());


	    




//graph.create();









	}
	
	function getSectorDetails(sectorId)
	{
		url = 'http://www.naukrihub.com/best-workplaces/employerrating/testsector.jsp?sectorid='+sectorId;
		
		httpRequest(url, "sectorDetails");
	}
