﻿
// JScript File

function ShowJobBasket() {
    msgWindow = window.open('/JobBasket.aspx', 'JobBasket', 'toolbar=no,menubar=no,status=yes,scrollbars=yes,height=520,width=640');
    msgWindow.focus();
}

function ShowHelpWindow(url,name,height,width)
{
    var helpWindow;
    helpWindow=window.open(url,name,"toolbar=no,menubar=no,statusbar=no,scrollbars=no,height=" + height + ",width=" + width);
    helpWindow.focus();
}

function switchimages(newimageSrc) {
    document.getElementById("ImageButton2").src = newimageSrc;
    
    if (document.getElementById("ImageButton2").style.cursor =='hand')
        document.getElementById("ImageButton2").style.cursor='pointer';
    else
        document.getElementById("ImageButton2").style.cursor='hand';
}
function cntrlFocus(className)
{
	var div = getElementsByClass(className, document, "input");
	if (div!=null && div.length==1)
	{
	    div[0].focus();
	}
}
function disablebtn(className)
{
      var div = getElementsByClass(className, document, "input");

	if (div!=null && div.length==1)
	{
	    div[0].disabled=true;
	}
}
function getElementsByClass(searchClass,node,tag)
{
	var classElements = new Array();
	if (node == null)
		node = document;
	if (tag == null)
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) 
	{
		if (pattern.test(els[i].className) ) 
		{
			classElements[j] = els[i];
			j++;
		}
	}
return classElements;
}

n = navigator.userAgent;
w = n.indexOf("MSIE");

if((w>0)&&(parseInt(n.charAt(w+5))>5))
{
    T=["object","embed","applet"];
    for(j=0;j<2;j++)
    {
        E=document.getElementsByTagName(T[j]);
        for(i=0;i<E.length;i++)
        {
            P=E[i].parentNode;
            H=P.innerHTML;
            P.removeChild(E[i]);
            P.innerHTML=H;
        }
    }
}


function ExpandCollapse(containerDiv, targetDiv)
{
    var oDiv;
    var contDiv = document.getElementById(containerDiv);
    
	var aDiv = contDiv.getElementsByTagName("div");
	var iDivLength = aDiv.length;

   // Find out what the current state of the targetDiv is
    var aState = document.getElementById(targetDiv).style.display;  

    // Collapse all divs
	for(i=0; i<iDivLength; i++)
	{
		oDiv = aDiv[i];
		if (oDiv.id.substring(0, 4) == "cont")
              oDiv.style.display = "none";
	}
	
	// expand or collapse the message depending on its original state
	if (aState == "none")
    	document.getElementById(targetDiv).style.display = "block";
    else
       document.getElementById(targetDiv).style.display = "none";

}

function mapclick(selectedCountry, titleID, reTitle, thisCount) {
    
    var TitleControl = document.getElementById(titleID);
    
    $(function() {

        var hldr = $('[class^=mapHolder]');

        hldr.removeClass(hldr.attr('class'));
        hldr.addClass('mapHolder' + selectedCountry);

        $('.cntry').val(selectedCountry);
    });
    
    if (reTitle)
        TitleControl.innerHTML = thisCount;    
}

//
//  There is a bug in IE7 on Windows Vista that ignores 'return false' to cancel click events.
//  Use this function instead, which will use a different way of cancelling the event for IE.
//
function CancelEvent() {
    // IE only event cancel.
    if (window.event)
        window.event.cancelBubble = true;

    // Standard return false for every other browser.
    return false;
}

function ExpandLinks(divID, imgID) {
    var div = document.getElementById(divID);
    var img = document.getElementById(imgID);
    if (div.style.display == 'none') {
        div.style.display = 'block';
    } else {
        div.style.display = 'none';
    }

    if (img.src.indexOf('/Images/icons/pluslist.gif') >= 0) {
        img.src = '/Images/icons/minuslist.gif';
    } else {
        img.src = '/Images/icons/pluslist.gif';
    }
    return false;
} // //  There is a bug in IE7 on Windows Vista that ignores 'return false' to cancel click events. //  Use this function instead, which will use a different way of cancelling the event for IE. // function CancelEvent() { // IE only event cancel. if (window.event) window.event.cancelBubble = true; // Standard return false for every other browser. return false; }

$(function() {
    $(".s1").dropdownchecklist({ width: 258 });
});
