function InitializeRequest(sender, args) {

    if (document.getElementById('ProgressDiv') != null)

        $get('ProgressDiv').style.display = 'block';

    else

        createContorl();

}



function EndRequest(sender, args) {

    if (document.getElementById('ProgressDiv') != null)

        $get('ProgressDiv').style.display = 'none';

    else

        createContorl();
}



function SetScroll(lb, SelInd) {

if (document.getElementById(lb)) { 
    document.getElementById(lb).selectedIndex=SelInd ; }
}


function preloadFlash() {
    Preload01 = new Image();
    Preload01.src = "FaQxeJY6mTQ=/ajax-loader.gif";
} 

var HeartBeatTimer;

function StartHeartBeat() {
    // pulse every 10 seconds
    if (HeartBeatTimer == null)
        HeartBeatTimer = setInterval("HeartBeat()", 1000 * 10);
}

function HeartBeat() {
    // note: ScriptManger must have: EnablePageMethods="true"    
    PageMethods.PokePage();
}



function ChangeChkForecolor() {
    if (document.getElementById("chkActive").checked = "false") {
        document.getElementById("chkActive").color = "Red";

    } else {
        document.getElementById("chkActive").color = "Green";
    }
}


function NavigateHome() {
    javascript: window.open("http://www.jobspeed.com");
}

function OpenPage(link) {
    javascript: window.open(link);
}

function NavigateIndeed(link) {
    javascript: window.open(link);
}



function GetImageWAndH(imgName) {
    var w
    var h
    var img

    img = document.getElementById(imgName)

    w = img.width
    h = img.height
    alert("pic width=" + img.width + " pic height=" + img.height);
    img.width = (w / 2)
    img.height = (h / 2)
    alert("pic width=" + img.width + " pic height=" + img.height);
}


function GetTextBoxValue(id) {
    return (document.getElementById(id).value);
}

function ShowDateChooser(Src) {


    //            var theWin = window.open('DatePicker.aspx?src=' + src, 'calendarPopup', 'width=200,height=100,resizable=no,scrollbars=no, titlebar=no, toolbar=no',true);
    //            theWin.opener = self;
    //            theWin.focus();

    window.open("DateChooser.aspx?src=" + Src, "_blank",
            "height=210, width=250, left=200, top=200, " +
            "location=no, menubar=no, resizable=no, " +
            "scrollbars=no, titlebar=no, toolbar=no", true);
}

function ShowSmallSignUp(eid, jid) {

    window.open("SignUpSmall.aspx?eid=" + eid + "&jid=" + jid, "_blank",
            "height=255, width=430, left=300, top=300, " +
            "location=no, menubar=no, resizable=no, " +
            "scrollbars=no, titlebar=no, toolbar=no", true);

    return false;
}

function ShowFlagJob(jid) {

    window.open("FlagJob.aspx?jid=" + jid, "_blank",
            "height=420, width=530, left=300, top=300, " +
            "location=no, menubar=no, resizable=no, " +
            "scrollbars=no, titlebar=no, toolbar=no", true);

    return false;
}


function ShowPopup(Param, ParamValue) {

    window.open("Popup.aspx?" + Param + "=" + ParamValue, "_blank",
            "height=420, width=530, left=300, top=300, " +
            "location=no, menubar=no, resizable=no, " +
            "scrollbars=no, titlebar=no, toolbar=no", true);

    return false;
}


function CheckOtherIsCheckedByGVID(spanChk, gv) {
    var IsChecked = spanChk.checked;
    if (IsChecked) {
        spanChk.parentElement.parentElement.style.backgroundColor = '#228b22';
        spanChk.parentElement.parentElement.style.color = 'white';
    }

    var CurrentRdbID = spanChk.id;
    var Chk = spanChk;
    Parent = document.getElementById(gv);
    var items = Parent.getElementsByTagName('input');

    for (i = 0; i < items.length; i++) {
        if (items[i].id != CurrentRdbID && items[i].type == "radio") {
            if (items[i].checked) {
                items[i].checked = false;
                items[i].parentElement.parentElement.style.backgroundColor = '#CCCCCC';
                items[i].parentElement.parentElement.style.color = 'black';
            }
        }
    }
}


function ClearCheckedOptions() {
    Parent = document.getElementById('gvCoverLetters');
    var items = Parent.getElementsByTagName('input');

    for (i = 0; i < items.length; i++) {
        items[i].checked = false;
        items[i].parentElement.parentElement.style.backgroundColor = '#CCCCCC';
        items[i].parentElement.parentElement.style.color = 'black';
    }

}

function StartFunction() {
    maximizewindow()
}




function SetTextToNothing(txt) {
    document.getElementById(txt).value = '';
}



function ShowDiv(divtoshow) {
    document.getElementById(divtoshow).style.display = 'block';
}



function HideDiv(divtohide) {

    document.getElementById(divtohide).style.display = 'none';
}



function maximizewindow() {
    if (window.screen) {
        this.moveTo(0, 0);
        this.resizeTo(screen.availWidth, screen.availHeight)

    }
}

function maximizewindow75Width() {
    if (window.screen) {
        this.moveTo(0, 0);
        this.resizeTo(screen.availWidth / 1.5, screen.availHeight)
    }
}

function countDown(control, maxLen, counter, typeName) {
    var len = control.value.length;
    var txt = control.value;
    var span = document.getElementById(counter);
    span.style.display = '';
    span.innerHTML = (maxLen - len) + ' characters remaining';
    if (len >= (maxLen - 10)) {
        span.style.color = 'red';
        if (len > maxLen) {
            control.innerHTML = txt.substring(0, maxLen);
            span.innerHTML = (maxLen - control.value.length) + ' characters remaining';
        }
    } else {
        span.style.color = '#000000';
    }
}


function WarnBadWords() {
    return confirm("There are Prohibited Words in your comment that will be replaced.  Do you wish to Edit your Comment?");
}

function RaiseAlert(Alert, Source) {
    alert(alert + ' -- ' + source);
}


function MoveToLocation(location) {
    window.location = '#' + location;
}



/*
// ///////////////////////////
// checkCapsLock v1.0
// 
// If a user enters his password in a Web-based form with Caps Lock 
// accidentally on, he can become frustrated because his password is not 
// being accepted... and he may assume the application is the source of the 
// problem.
// 
// This JavaScript function will let the user know his Caps Lock is on and 
// about the potential for error.
// ///////////////////////////
*/

function checkCapsLock(e, lbl) {
    var myKeyCode = 0;
    var myShiftKey = false;
    var labelCaps = lbl
    var isIE4 = document.all;
    var isNS4 = document.layers;
    var isNS6 = document.getElementById && !document.all;
    var M_Hide = isNS4 ? 'hide' : 'hidden';
    var M_Show = isNS4 ? 'show' : 'visible';


    // Internet Explorer 4+
    if (document.all) {
        myKeyCode = e.keyCode;
        myShiftKey = e.shiftKey;

        // Netscape 4
    } else if (document.layers) {
        myKeyCode = e.which;
        myShiftKey = (myKeyCode == 16) ? true : false;

        // Netscape 6
    } else if (document.getElementById) {
        myKeyCode = e.which;
        myShiftKey = (myKeyCode == 16) ? true : false;

    }

    // Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
    if ((myKeyCode >= 65 && myKeyCode <= 90) && !myShiftKey) {

        document.getElementById(labelCaps).style.visibility = M_Show;

        // Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
    } else if ((myKeyCode >= 97 && myKeyCode <= 122) && myShiftKey) {

        document.getElementById(labelCaps).style.visibility = M_Show;


    } else if ((myKeyCode >= 97 && myKeyCode <= 122)) {
        document.getElementById(labelCaps).style.visibility = M_Hide;
    }
}

//these are used for google maps on popup.master

//            function ctl(id) { return document.getElementById(id) }

//            function placeArrow(location, zoom) {
//                deleteOverlays();
//                map.setCenter(location);
//                var image = new google.maps.MarkerImage('http://www.google.com/mapfiles/arrow.png',
//		new google.maps.Size(38, 34),
//		new google.maps.Point(0, 0),
//		new google.maps.Point(10, 34));
//                var shadow = new google.maps.MarkerImage('http://www.google.com/mapfiles/arrowshadow.png',
//		new google.maps.Size(38, 34),
//		new google.maps.Point(0, 0),
//		new google.maps.Point(10, 34));
//                var arrow = new google.maps.Marker({
//                    position: location,
//                    map: map,
//                    shadow: shadow,
//                    icon: image,
//                    title: ''
//                });
//                arrowArray.push(arrow);
//                map.setZoom(zoom);
//            }
//            function deleteOverlays() {
//                if (markersArray) {
//                    for (i in markersArray) { markersArray[i].setMap(null); }
//                    markersArray.length = 0;
//                }
//                if (arrowArray) {
//                    for (i in arrowArray) { arrowArray[i].setMap(null); }
//                    arrowArray.length = 0;
//                }
//            }

//            function getLocationComponent(googlePlace, locationComponentType) {
//                for (var i = 0; i < googlePlace.address_components.length; i++) {
//                    switch (googlePlace.address_components[i].types[0]) {
//                        case locationComponentType:
//                            return googlePlace.address_components[i].short_name;
//                    }
//                }
//                return "";
//            }
//            function getCountryCode(googlePlace) {
//                return getLocationComponent(googlePlace, "country");
//            }
//            function getStateCode(googlePlace) {
//                return getLocationComponent(googlePlace, "administrative_area_level_1");
//            }
//            function getCityName(googlePlace) {
//                return getLocationComponent(googlePlace, "locality");
//            }
//            function getPostalCode(googlePlace) {
//                return getLocationComponent(googlePlace, "postal_code");
//            }
//            function getLatitude(googlePlace) {
//                return googlePlace.geometry.location.b;
//            }
//            function getLongitude(googlePlace) {
//                return googlePlace.geometry.location.c;
//            }

//            function sf() { ctl('q').focus(); }

//            function clearHiddenFields() {
//                ctl('lat').value = '';
//                ctl('lng').value = '';
//                ctl('lct').value = '';
//                ctl('ls').value = '';
//                ctl('lc').value = '';
//                ctl('lz').value = '';
//                ctl('lz').value = '';
//                ctl('accuracy').value = '';
//                ctl('address').value = '';
//            }

//            function saveLocation(googlePlace) {
//                ctl('lat').value = getLatitude(googlePlace);
//                ctl('lng').value = getLongitude(googlePlace);
//                ctl('lct').value = getCountryCode(googlePlace);
//                ctl('ls').value = getStateCode(googlePlace);
//                ctl('lc').value = getCityName(googlePlace);
//                ctl('lz').value = getPostalCode(googlePlace);
//                ctl('accuracy').value = accuracy(googlePlace);
//                ctl('address').value = googlePlace.formatted_address;
//                inProgress = false;
//            }

//            function accuracy(googlePlace) {
//                var zoom = null;
//                if (getCountryCode(googlePlace) !== '') zoom = 1;
//                if (getStateCode(googlePlace) !== '') zoom = 2;
//                if (getCityName(googlePlace) !== '') zoom = 4;
//                if (getPostalCode(googlePlace) !== '') zoom = 5;
//                return zoom;
//            }

//            function geocode() {
//                if (inProgress == true) return;
//                uLocation = ctl('l').value;
//                if (uLocation.length > 0) {
//                    inProgress = true;
//                    var geocoder = new google.maps.Geocoder();
//                    var address = uLocation;
//                    if (geocoder) {
//                        geocoder.geocode({ 'address': address }, geocodingResultsPostBack);
//                    }
//                }
//                else { clearHiddenFields(); }
//            }

//            function geocodingResultsPostBack(results, status) {
//                if (status == google.maps.GeocoderStatus.OK) {
//                    var placemarkLength = results.length;
//                    switch (placemarkLength) {
//                        case 0:
//                            handleBadGeocoding(status);
//                            break;
//                        default:
//                            saveLocation(results[0]);
//                            clickSearchIfNeeded(); break;
//                            break;
//                    }
//                } else {
//                    handleBadGeocoding(status);
//                }
//            }

//            function handleBadGeocoding(status) {
//                var message = 'Location: ' + uLocation + '; Status: ' + status;
//                log(message);
//                clearHiddenFields();
//                inProgress = false;
//                clickSearchIfNeeded();
//            }

//            function clickSearchIfNeeded() {
//                if (needToClickSearch == true) { searchClick(); }
//            }

//            function searchClick() { ctl('search').click(); }

//            function setC(c1, c2) {
//                c1 = ctl(c1);
//                c2 = ctl(c2);
//                c1.style.textDecoration = 'none';
//                c1.style.color = 'black';
//                c1.style.fontSize = 'medium';
//                c2.style.textDecoration = 'underline';
//                c2.style.color = 'blue';
//                c2.style.fontSize = 'small';
//            }

//            function submitHandler() {
//                if (inProgress == true) {
//                    needToClickSearch = true;
//                    return false;
//                }
//                if (uLocation == ctl('l').value) {
//                    needToClickSearch = false;
//                    return true;
//                }
//                needToClickSearch = true;
//                geocode();
//                return false;
//            }

//            function linkAction() {
//                sf();
//                if ((ctl('q').value != '') || (ctl('l').value != '')) { searchClick(); }
//                return false;
//            }

//            function initMap() {
//                var myOptions = {
//                    navigationControl: true,
//                    mapTypeControl: false,
//                    scaleControl: false,
//                    mapTypeId: google.maps.MapTypeId.ROADMAP
//                };
//                map = new google.maps.Map(ctl('divGoogleMap'), myOptions);
//                var location = ctl('inLocation').value.split(',');
//                var centerMap = new google.maps.LatLng(location[0], location[1]);
//                placeArrow(centerMap, setArrowZoom());
//            }

//            function setArrowZoom() {
//                var zoom = 2;
//                if (ctl('StateSpan') != undefined) { zoom = 3; }
//                if (ctl('CitySpan') != undefined) { zoom = 4; }
//                return zoom;
//            }



//    * ClientLocation.latitude — supplies the low resolution latitude associated with the client's IP address
//    * ClientLocation.longitude — supplies the low resolution longitude associated with the client's IP address
//    * ClientLocation.address.city — supplies the name of the city associated with the client's IP address
//    * ClientLocation.address.country — supplies the name of the country associated with the client's IP address
//    * ClientLocation.address.country_code — supplies the name of the ISO 3166-1 country code associated with the client's IP address
//    * ClientLocation.address.region — supplies the country specific region name associated with the client's IP address



function getGoogleState() {
    //this.currentState_ = this.options_.startingState;
    if (google.loader.ClientLocation &&
        google.loader.ClientLocation.address.country_code == "US" &&
        google.loader.ClientLocation.address.region) {
        // geo locate was successful and user is in the United States. range
        // check the region so that we can safely use it when selecting a
        // state level polygon overlay
        //            var lati = google.loader.ClientLocation.latitude;
        //            var longi = google.loader.ClientLocation.longitude;
        //            var city = google.loader.ClientLocation.address.city;
        //            var country = google.loader.ClientLocation.address.country;
        //            var countrycode = google.loader.ClientLocation.address.country_code;
        var region = google.loader.ClientLocation.address.region.toUpperCase();

        //if (InTheNews.stateNames[state]) {
        //this.currentState_ = state;
        //control.value=state;
        //}
        //alert('State=' + state );
        //var tbox = document.getElementById('ctl00_MainContent_txtMyState');
        var allinfo = region; //lati + "," + longi + "," + city + "," + country + "," + countrycode + "," + region;

        document.cookie = 'loccookie=' + allinfo + '; expires=Fri, 21 Sep 2012 20:47:11 UTC; path=/';
    }
    else {
    }
} //end function
//document.getElementById('<% =jsLocation.ClientId %>').value = allinfo;
//document.getElementById('jsLocation').value = allinfo;


//tbox.value = lati + "," + longi + "," + city + "," + country + "," + countrycode  + "," + region
//}
//control.value= "US";

function getGoogleCo() {

    if (google.loader.ClientLocation) {

        var countrycode = google.loader.ClientLocation.address.country_code;

        document.cookie = 'googlecocookie=' + countrycode + '; expires=Fri, 21 Sep 2012 20:47:11 UTC; path=/';
        return countrycode;
    }




} //end function


//<![CDATA[
function ipGeocoding(btn, countryctl, statectl, cityctl) {
    if (google.loader.ClientLocation) {
        var clientLocation = google.loader.ClientLocation;
        var countrycode = clientLocation.address.country_code;
        var state = '';
        var city = '';
        if (clientLocation.address.region) {
            state = clientLocation.address.region;

            document.getElementById(statectl).value = state;
            if (clientLocation.address.city) {
                city = clientLocation.address.city;

                document.getElementById(cityctl).value = city;
            }
        }
        var lat = clientLocation.latitude;
        var lng = clientLocation.longitude;
        var country = '';
        if (clientLocation.address.country) {
            country = clientLocation.address.country;

            document.getElementById(countryctl).value = country;
        }

        //alert('country=' + countrycode + ' state=' + state + ' city=' + city);
        //var frmID = document.getElementById(frm);

        //alert('form=' + frmID);

        //frmID.submit();

        var btnID = document.getElementById(btn)

        btnID.click();

        //__doPostBack(btn, 'OnClick');

    }
}
//]]>


function GetGoogleCity() {
    if (google.loader.ClientLocation) {
        var city = '';
        if (clientLocation.address.region) {
            if (clientLocation.address.city) {
                city = clientLocation.address.city;
                return (city);
            }
        }
    }
}

