var SrchFlag=false;function loadEmpIndData(pageIndex,pageSize,search)
{document.getElementById("hdnJobIndustries").value = pageIndex;document.getElementById("hdnIndustriesPageSize").value = pageSize;document.getElementById("hdnFeaturedEmployers").value = pageIndex;document.getElementById("hdnEmployersPazeSize").value = pageSize;if(search=="true")
SrchFlag=true;else
SrchFlag=false;NexgenIndexService.IndexService.FillIndustries(loadIndustries,onerror);NexgenIndexService.IndexService.FillEmployers(loadEmployers,onerror);}
function onerror(error)
{}
function loadIndustries(response)
{var industriesDoc = null;var responseIndXml = CheckSpecialSymbols(response);if (window.ActiveXObject)
{if(industriesDoc == null)
{industriesDoc=new ActiveXObject("Microsoft.XMLDOM");industriesDoc.async=false;industriesDoc.loadXML(responseIndXml);} 
bulidIndustries(industriesDoc);}
else if (document.implementation && document.implementation.createDocument)
{if(industriesDoc == null)
{var parser=new DOMParser();industriesDoc=parser.parseFromString(responseIndXml,"text/xml");}
bulidIndustries(industriesDoc);}
}
function CheckHtmlCodeToSpecialSymbols(strData)
{if(strData.indexOf('&amp;')>-1)
{return strData.replace(/&amp;/g,'&');}
else
return strData
}
function bulidIndustries(industriesDoc)
{var industriesNames = document.getElementById("jobIndustries");if(industriesDoc != null)
{if(industriesDoc.getElementsByTagName("IndustryId").length > 0)
{document.getElementById("hdnIndustriesLength").value = industriesDoc.getElementsByTagName("IndustryId").length;var indlength = parseInt(document.getElementById("hdnIndustriesLength").value);var indPageIndex = parseInt(document.getElementById("hdnJobIndustries").value);var indPazeSize = parseInt(document.getElementById("hdnIndustriesPageSize").value);var totalPages = Math.ceil(indlength/indPazeSize);if(totalPages > 1)
{document.getElementById("lnkMore").style.display = "block";}
else
{document.getElementById("lnkMore").style.display = "none";}
if(indPageIndex > 1)
{document.getElementById("lnkPrevious").style.display = "block";}
else
{document.getElementById("lnkPrevious").style.display = "none";}
if(indPageIndex == totalPages)
{document.getElementById("lnkMore").style.display = "none";}
if(indPageIndex == 1)
{indexCount = 0;}
else
{indexCount = parseInt(indPageIndex - 1) * parseInt(indPazeSize) ;}
document.getElementById("jobIndustries").innerHTML ="";var colCount = 0;for(var indCount = indexCount;indCount < (parseInt(indPageIndex) * parseInt(indPazeSize));indCount++)
{if(indCount < indlength)
{if(colCount > 2)
{colCount = 0;}
if(colCount == 0)
{rowDiv = document.createElement("div");rowDiv.style.marginBottom = "5px";rowDiv.style.position = "relative";rowDiv.style.clear = 'both';}
var indDiv = document.createElement("div");var anchor = document.createElement("a");anchor.style.width = "100%";indDiv.style.width = "33%";indDiv.style.styleFloat = 'left';indDiv.style.cssFloat = 'left';indDiv.style.position = "relative";var hyperRef = document.createAttribute("href");if(!SrchFlag)
hyperRef.value = industriesDoc.getElementsByTagName("NavURL")[indCount].firstChild.nodeValue;else
hyperRef.value = industriesDoc.getElementsByTagName("NavURL1")[indCount].firstChild.nodeValue;anchor.setAttributeNode(hyperRef);var textNodeValue=CheckHtmlCodeToSpecialSymbols(industriesDoc.getElementsByTagName("Industry")[indCount].firstChild.nodeValue+"("+industriesDoc.getElementsByTagName("TotalJobs")[indCount].firstChild.nodeValue+")");var industryName=document.createTextNode(textNodeValue);anchor.appendChild(industryName);indDiv.appendChild(anchor);rowDiv.appendChild(indDiv);industriesNames.appendChild(rowDiv);colCount++;}
}
}
else
{document.getElementById("jobIndustries").innerHTML="There are no industries available";}
}
}
function prevIndustries()
{document.getElementById("hdnJobIndustries").value = parseInt(document.getElementById("hdnJobIndustries").value) - 1;loadIndustriesData();}
function loadIndustriesData()
{NexgenIndexService.IndexService.FillIndustries(loadIndustries,onerror);}
function nextIndustries()
{document.getElementById("hdnJobIndustries").value = parseInt(document.getElementById("hdnJobIndustries").value) + 1;loadIndustriesData();}
function loadEmployers(empResponse)
{var employersDoc = null;var responseEmpXml = CheckSpecialSymbols(empResponse);if (window.ActiveXObject)
{if(employersDoc == null)
{employersDoc=new ActiveXObject("Microsoft.XMLDOM");employersDoc.async=false;employersDoc.loadXML(responseEmpXml);} 
buildEmployers(employersDoc);}
else if (document.implementation && document.implementation.createDocument)
{if(employersDoc == null)
{var parser=new DOMParser();employersDoc=parser.parseFromString(responseEmpXml,"text/xml");}
buildEmployers(employersDoc);}
}
function buildEmployers(employersDoc)
{var indexEmpCount ;var EmployerNames = document.getElementById("featurEmployers");if(employersDoc != null)
{if(employersDoc.getElementsByTagName("CompanyId").length > 0)
{document.getElementById("hdnEmployersLength").value = employersDoc.getElementsByTagName("CompanyId").length;var emplength = parseInt(document.getElementById("hdnEmployersLength").value);var empPageIndex = parseInt(document.getElementById("hdnFeaturedEmployers").value);var empPazeSize = parseInt(document.getElementById("hdnEmployersPazeSize").value);var totalPages = Math.ceil(emplength/empPazeSize);if(totalPages > 1)
{document.getElementById("lnlMoreEmp").style.display = "block";}
else
{document.getElementById("lnlMoreEmp").style.display = "none";}
if(empPageIndex > 1)
{document.getElementById("lnkPrevEmp").style.display = "block";}
else
{document.getElementById("lnkPrevEmp").style.display = "none";}
if(empPageIndex == totalPages)
{document.getElementById("lnlMoreEmp").style.display = "none";}
if(empPageIndex == 1)
{indexEmpCount = 0;}
else
{indexEmpCount = parseInt(empPageIndex - 1) * parseInt(empPazeSize) ;}
document.getElementById("featurEmployers").innerHTML ="";colCount = 0;for(var empCount = indexEmpCount;empCount < (parseInt(empPageIndex) * parseInt(empPazeSize));empCount++)
{if(empCount < emplength)
{var OnClickUrl;if(!SrchFlag)
{OnClickUrl = employersDoc.getElementsByTagName("NavURL")[empCount].text?employersDoc.getElementsByTagName("NavURL")[empCount].text:employersDoc.getElementsByTagName("NavURL")[empCount].textContent;var asfk =" onclick='ShowOrganizationMicroSite(\"" + employersDoc.getElementsByTagName("NavURL")[empCount].text + "?" + employersDoc.getElementsByTagName("NavURL")[empCount].text + ":" + + employersDoc.getElementsByTagName("NavURL")[empCount].textContent +" \")'>";}
else
{OnClickUrl = employersDoc.getElementsByTagName("NavURL")[empCount].text?employersDoc.getElementsByTagName("NavURL")[empCount].text:employersDoc.getElementsByTagName("NavURL")[empCount].textContent;var asfk =" onclick='ShowOrganizationMicroSite(\"" + employersDoc.getElementsByTagName("NavURL")[empCount].text + "?" + employersDoc.getElementsByTagName("NavURL")[empCount].text + ":" + + employersDoc.getElementsByTagName("NavURL")[empCount].textContent +" \")'>";}
var anchor = "<div style='float:left;width:33%' ><a href='javascript:void(0)' class='link_fea'";anchor += " onclick='ShowOrganizationMicroSite(\"" + OnClickUrl +"\")'>";anchor += employersDoc.getElementsByTagName("CompanyName")[empCount].firstChild.nodeValue + "</a>";EmployerNames.innerHTML += anchor + "</div>";}
}
}
}
}
function ShowOrganizationMicroSite(microSitePath)
{var width = window.screen.availWidth;var height = window.screen.availHeight;try{win = window.open(microSitePath,"_blank",
"width=" + width + ",height=" + height + "left=0,top=0,status=no,toolbar=no,scrollbars=yes,addressbar=no,menubar=no,location=no,resizable=yes");win.moveTo(0,0);}catch(ex){}
}
function prevEmployers()
{document.getElementById("hdnFeaturedEmployers").value = parseInt(document.getElementById("hdnFeaturedEmployers").value) - 1;loadEmployersData();}
function loadEmployersData()
{NexgenIndexService.IndexService.FillEmployers(loadEmployers,onerror);}
function nextEmployers()
{document.getElementById("hdnFeaturedEmployers").value = parseInt(document.getElementById("hdnFeaturedEmployers").value) + 1;loadEmployersData();}


