function initialize() {
  if (GBrowserIsCompatible()) {
	map = new GMap2(document.getElementById("map_canvas"),{draggableCursor: 'default', draggingCursor: 'pointer'});
	map.setCenter(new GLatLng(0, 0), 2);
	map.setUIToDefault();
  }
}


$(document).ready(function(){
	
	$('#location').change(function(){
		if ($(this).attr('value') == 0) return;
		window.location = $(this).attr('value');
	});
	
	$('#search-job').submit(function(){
		if ($('#job-title').attr('value') != '0') 
			window.location = $('#job-title').attr('value');
				else 
					if ($('#location').attr('value') != '0') 
						window.location = $('#location').attr('value');
		return false;
	});
	
	$('#search-job-side').submit(function(){
		if ($('#job-title-side').attr('value') != '0') 
			window.location = $('#job-title-side').attr('value');
				else 
					if ($('#location-side').attr('value') != '0') 
						window.location = $('#location-side').attr('value');
		return false;
	});
	$('iframe').iframeAutoHeight();
	
});

 //**************swap image*******************

function MM_swapImage() { //v3.0

  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

}



 //**************image restore*******************

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



 //**************preload images*******************

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}






 //**************layer swap*******************

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



function MM_showHideLayers() { //v6.0

  var i,p,v,obj,args=MM_showHideLayers.arguments;

  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}

 //**************end layer swap*******************




// function that displays status bar message



function dm(msgStr) {

  document.returnValue = false;

  if (document.images) { 

     window.status = msgStr;

     document.returnValue = true;

  }

}

var showMsg = navigator.userAgent != "Mozilla/4.0 (compatible; MSIE 4.0; Mac_PowerPC)";

function dmim(msgStr) {

  document.returnValue = false;

  if (showMsg) { 

    window.status = msgStr;

    document.returnValue = true;

  }

}

var ns6 = document.getElementById && ! document.all ? 1 : 2;
var expandedflag = false;
function expandit(job_id, name) {
	if (expandedflag == false) {
		displaydiv = ns6 ? document.getElementById(name + "_" + job_id).style : document.all[name + "_" + job_id].style;
		showdiv = ns6 ? document.getElementById(name + "_show_" + job_id).style : document.all[name + "_show_" + job_id].style;
		hidediv = ns6 ? document.getElementById(name + "_hide_" + job_id).style : document.all[name + "_hide_" + job_id].style;
		displaydiv.display = "inline";
		showdiv.display = "none";
		hidediv.display = "inline";
		expandedflag = true;
	}
	else {
		displaydiv = ns6 ? document.getElementById(name + "_" + job_id).style : document.all[name + "_" + job_id].style;
		showdiv = ns6 ? document.getElementById(name + "_show_" + job_id).style : document.all[name + "_show_" + job_id].style;
		hidediv = ns6 ? document.getElementById(name + "_hide_" + job_id).style : document.all[name + "_hide_" + job_id].style;
		displaydiv.display = "none";
		showdiv.display = "inline";
		hidediv.display = "none";
		expandedflag = false;
	}
}

function toggle(id) {
    var elem = document.getElementById(id);
    elem.style.visibility = (elem.style.visibility == "hidden")?"":"hidden";
}


(function ($) {
    $.fn.iframeAutoHeight = function (options) {
        // set default option values
        var options = $.extend({
            heightOffset: 0
        }, options);

        // iterate over the matched elements passed to the plugin
        $(this).each(function () {
            // Check if browser is Opera or Safari(Webkit so Chrome as well)
            if ($.browser.safari || $.browser.opera) {
                // Start timer when loaded.
                $(this).load(function () {
                    var iframe = this;
                    var delayedResize = function () {
                        resizeHeight(iframe);
                    };
                    setTimeout(delayedResize, 0);
                });

                // Safari and Opera need a kick-start.
                var source = $(this).attr('src');
                $(this).attr('src', '');
                $(this).attr('src', source);
            }
            else {
                // For other browsers.
                $(this).load(function () {
                    resizeHeight(this);
                });
            }

            // resizeHeight
            function resizeHeight(iframe) {
                // Set inline style to equal the body height of the iframed content plus a little
                var newHeight = iframe.contentWindow.document.body.offsetHeight + options.heightOffset;
                iframe.style.height = newHeight + 'px';
            }

        }); // end
    }
})(jQuery);


