function getInternetExplorerVersion()
{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

var jvcount = 0;
var jvwidgetisie = false;
var jvwidgetAPIUseActiveX = false;
var ifmousedown = false;
var ifEventSet = false;
try
{
	if (window.clientInformation)
	{
		var s = window.clientInformation.userAgent;
		var p = s.indexOf('MSIE');
		if (p != -1)
		{
			jvwidgetisie = true;
			s = s.substring(p + 5);
			p = s.indexOf('.');
			if (p != -1)
				jvwidgetAPIUseActiveX = (s.substring(0, p) - 0) < 7;
		}
	}
}
catch (e)
{
}

// attaching the event for firefox 
var globalEventObj = null;
if (document.addEventListener)
	document.addEventListener("mousedown", setMousePosition, false)
function setMousePosition( event ){
	globalEventObj = event;
}

function getMouseVerticalPosition(){
	if (globalEventObj && globalEventObj.clientY)
		return globalEventObj.clientY;
	else
		return 0;
}

var JOBVITE  = JOBVITE || { }; 

JOBVITE.Score = {
	createTemplate: function( ){
		var template ='<div style="background-color: #cecece; padding: 10px; border: 2px solid #333333;">\
							<form name="t" id="t">\
								<table align="center">\
									<tr align="center">\
										<td width="50">Title 1 </td>\
										<td align="left"> <input name="t1" value="" size="30"/></td>\
									</tr>\
									<tr align="center">\
										<td width="50">Title 2 </td>\
										<td align="left"> <input name="t2" value="" size="30"/></td>\
									</tr>\
									<tr align="center">\
										<td width="50">Score </td>\
										<td align="left"> <input name="s" id="s" value="" size="30"/></td>\
									</tr>\
									<br/>\
									<tr align="center">\
										<td><input type="button" name="get" value="Get Score" onClick="JOBVITE.Score.getScore()"/></td>\
										<td align="left"><input type="button" name="add" value="Add Map" onClick="JOBVITE.Score.commitScore()"/></td>\
						            </tr>\
								</table>\
							</form>\
						</div>';
		return template;
	},
	
	popupDialog: function( ){
		me = this;
		jvwidgetAPIExecute( "getWidgetDisplayFlag", '', me.renderDialog );	
	},
	
	renderDialog: function( val ){
		// Can if we can display the widget.		
		if( val == "false" || val == ""){
			return;
		}
		var ref = document.getElementById( "jv_scoreContainer");
		if( ref.innerHTML != "" ){
			ref.innerHTML = "";
			return;
		}
		var template = JOBVITE.Score.createTemplate( );
		document.getElementById("jv_scoreContainer").innerHTML = template;
	},
	
	commitScore: function( ){
		var me = this;
		//var url = jvwidgetbaseurl + "TalentNetwork/ajax/title.html?action=add&t1=" + escape(document.t.t1.value) + "&t2=" + escape(document.t.t2.value) + "&s=" + decodeURIComponent(document.t.s.value);
		//jvwidgetAPIExecute( "commitScore", '{"t1":"'+ document.t.t1.value + '","t2":"'+ document.t2.s.value +'","s":"'+ document.t.s.value, me.commitScoreCallback +'"}');
		jvwidgetAPIExecute( "commitScore&t1="+ encodeURIComponent( document.t.t1.value )+ "&t2="+ encodeURIComponent( document.t.t2.value )+"&s="+ encodeURIComponent( document.t.s.value ), '', me.commitScoreCallback );
	},
	
	commitScoreCallback: function( val ){
		alert( val );	
	},
	
	getScore: function( ){
		var me = this;
		//var url = jvwidgetbaseurl + "TalentNetwork/ajax/title.html?action=get&t1=" + escape(document.t.t1.value) + "&t2=" + decodeURIComponent(document.t.t2.value);
		//jvwidgetAPIExecute( "getScore", '{"t1":"'+ document.t.t1.value + '","t2":"'+ document.t2.s.value +'"}' );		
		jvwidgetAPIExecute( "getScore&t1="+ encodeURIComponent( document.t.t1.value )+ "&t2="+ encodeURIComponent( document.t.t2.value ), '', me.getScoreCallback );
	},
	
	getScoreCallback: function( val ){
		document.t.s.value = val;
	}	
}

var jvwidgetbaseurl = window.location.href;
{
	var p = jvwidgetbaseurl.indexOf('?');
	if (p == -1)
		p = jvwidgetbaseurl.length;
	p = jvwidgetbaseurl.lastIndexOf('/', p);
	if (p != -1)
		p = jvwidgetbaseurl.lastIndexOf('/', p - 1);
	if (p != -1)
		jvwidgetbaseurl = jvwidgetbaseurl.substring(0, p + 1);
    
    //Raj adding fb connectivity for ssl sites
	var pos = jvwidgetbaseurl.indexOf('https') 
	if(pos >= 0)
        document.writeln('<div id="fb-root"></div><script src="https://connect.facebook.net/en_US/all.js"></script>');
    else
        document.writeln('<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js"></script>');            		
}
if (jvwidgetisie)
	document.writeln('<LINK href="' + jvwidgetbaseurl + 'widgetie22.css" type="text/css" rel="stylesheet">');
else
	document.writeln('<LINK href="' + jvwidgetbaseurl + 'widget22.css" type="text/css" rel="stylesheet">');
function jvwidgetAPIExecute(command, postdata, callback, toUrl)
{	
	var xmlHttpReq = (jvwidgetAPIUseActiveX ? new ActiveXObject('MSXML2.XMLHTTP.3.0') : new XMLHttpRequest());
	xmlHttpReq.onreadystatechange = function()
	{
		if (xmlHttpReq.readyState == 4 && xmlHttpReq.status == 200)
		{
			if (xmlHttpReq.responseText == 'Expired' || xmlHttpReq.responseText == 'Failed')
			{
				if (jvwidgetAPIExecute && jvwidgetAPIExecute._dialog)
				{
					var temp = '<div class="jvwidgetbody jvwidgetbodyheight">' +
					'<p>Your session has expired...<br><br>Please click the Restart button to continue sending Jobvites</p>' +
					'</div>' +
					'<div style="text-align: center;"><input type="button" class="jvwidgetbutton" value="Restart" onclick="window.location.href=window.location.href;" /></div>';
					jvwidget._content.innerHTML = temp;
				}
			}
			else if (callback)
				callback(xmlHttpReq.responseText);
		}
	}
	
	var url = jvwidgetbaseurl + 'API/API.aspx?command=' + command;	
	xmlHttpReq.open( "POST", url , true);
	xmlHttpReq.send(postdata);
	return '';
}
jvposition = function(container)
{
	this._x = 0;
	this._y = 0;
	this._container = container;
}
jvposition.prototype = 
{
	calculatePosition : function(o)
	{
		this._x = 0;
		this._y = 0;
		this._calculatePosition(o);
	},
	_calculatePosition : function(o)
	{		
		if (!this._container || o.id != this._container.id)
		{
			if (o.offsetLeft)
				this._x += o.offsetLeft;
			if (o.offsetTop)
				this._y += o.offsetTop;
			if (o.offsetParent)
				this._calculatePosition(o.offsetParent);
		}
	}
}
jvwidgetclass = function(companyid)
{
	this._dialog = null;
	this._x = 0;
	this._y = 0;
	this._overlayx = 100;
	this._overlayy = 100;
	this._offsetx = 0;
	this._offsety = 0;
	this._isMoving = false;
	this._onmousemove = null;
	this._object = null;
	this._companyId = companyid;
	this._timer = null;
	this._overlaysaveonresize = null;
	this._overlaytablex = 0;
	this._frame = null;
	this._Facebookprofile = null;
	this._onclose = null;
}
jvwidgetclass.prototype = 
{
    open : function(o, userId, jobIds, messageId, companyId, hasemployees, source) 
    {	
		var me = this;
		var jobIdList = (jobIds != null && typeof(jobIds.split) == 'function' ? jobIds.split(',') : jobIds);
		if (companyId)
			this._companyId = companyId;
		if (this._dialog)
			this.close();
		this._onmousemove = document.onmousemove;
		document.onmousemove = this.onmousemove;
		this._dialog = document.createElement('div');
		this._dialog.id = 'jvwidgetdiv';
		this._dialog.style.height = (hasemployees?420:420) + "px"
		
		var args = '[' + (userId ? '\'' + userId + '\'' : 'null') + ',\[';
		if (jobIdList != null)
		{
			for (var i = 0; i < jobIdList.length; i++)
			{
				if (i)
					args += ',';
				args += '\'' + jobIdList[i] + '\'';
			}
		}
		args += '],' + (messageId ? '\'' + messageId + '\'' : 'null');
		args += ',' + (companyId ? '\'' + companyId + '\'' : 'null');
		args += ',' + (hasemployees ? 'true' : 'false');
		args += ',' + (source ? '\'' + source + '\'' : 'null');
		args += ',' + '\'' + (this._jobboard ? this._jobboard.replace(/'\''/g,'\\\'') : '') + '\'';
		args += ']';
		var ww = window.innerWidth;
		var hh = window.innerHeight;
		if (!ww)
			ww = document.documentElement.clientWidth;
		if (!hh)
			hh = document.documentElement.clientHeight;
		if (!ww)
			ww = document.body.clientWidth;
		if (!hh)
			hh = document.body.clientHeight;
		var fw = 10;
		if (ww < 440)
		{
			fw = 2;
			this._dialog.style.width = '404px';
			this._dialog.style.height = '442px';
		};				
		
		//TODO: temporarily put the mapScore to true. Need to change after the testing is done.
		mapScore = true;
		var scoreHTML = '<img src="' + jvwidgetbaseurl + 'images2/Powered by Jobvite Logo 100x20.png" />';
		if( mapScore ){
			scoreHTML = '<a onClick="JOBVITE.Score.popupDialog( )">\
							<img src="' + jvwidgetbaseurl + 'images2/Powered by Jobvite Logo 100x20.png" />\
						</a>\
						<div style="position: absolute;*left:0px;*top:23px;" id="jv_scoreContainer"><div>';	
		}
		
		this._dialog.innerHTML =
			'<table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#555555" style="margin-bottom: 0px;"><tr><td style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="' + fw + '" /><td style="background-color: Transparent;" onmouseout="jvwidget.endmove( event );"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="400" height="' + fw + '" /><td style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="' + fw + '" /></td></tr><tr><td style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="' + fw + '" /></td><td style="background-color: Transparent;">' +
			'<div id="jvwidgetheader" ><table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#999999" style="margin: 0px 0px 0px 0px;"><tr><td style="padding-top: 2px; padding-bottom: 1px; padding-left: 3px; width: 16px; cursor: move; background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/Widget/Jobvite16.png" /></td><td style="padding-top: 1px; padding-bottom: 2px; padding-left: 3px; cursor: move; background-color: Transparent;"><div id="jv_widgetHeader_wrapper" ><span class="jvwidgetheader"> Send Jobvite - A personal job invitation</span></div></td><td align="right" style="padding-right: 1px; text-align: right; background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/Widget/Close16.png" border="0" width="16" height="16" id="jv_widgetClose" onclick="jvwidget.close();" style="cursor: pointer;"></td></tr></table></div>' +
			'</td><td   style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="' + fw + '" /></td></tr>' +
			'<tr onmouseover="jvwidget.endmove( event );" height="'+ (hasemployees?420:420) +'"><td style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="'+ (hasemployees?420:420) +'" /></td><td bgcolor="#f7f7f7" valign="top" style="vertical-align: top;">' +
			'<iframe id="jvwidgetcontent" name="jvwidgetcontent" src="' + jvwidgetbaseurl + 'Widget/Widget.aspx?args=' + escape(args) + '" height="'+ (hasemployees?420:420) +'" width="410" frameborder="0" scrolling="no"></iframe>' +
			'</td><td style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="' + fw + '" /></td></tr>' +
			'<tr>\
				<td style="background-color: Transparent;">\
					<img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="20" />\
				</td>\
				<td align="right" style="padding-right: 5px; text-align: right; background-color: Transparent; position: relative">\
					<a href="http://recruiting.jobvite.com/recruiting-contact-us-request.html" target="_new" style="float:left;text-decoration:underline;color:#ffffff" >\
						Get this for your site\
					</a>' + scoreHTML +'\
				</td>\
				<td style="background-color: Transparent;">\
					<img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="' + fw + '" height="10" />\
				</td>\
			</tr>' +
			'</table>';			
		var position = new jvposition(jvwidget._dialog);

//		if (o)		
//			position.calculatePosition(o);			
//		this._overlayx = position._x;
//		this._overlayy = position._y;		
		try{
			if (event && event.clientY)
			this._overlayy = event.clientY;
		}
		catch( e ){			
			this._overlayy = getMouseVerticalPosition();	
		}		
		
		this._dialog.style.position = 'absolute';
		
		//document.body.style.display = "none";
		//var centerElem = document.createElement('center');
		//centerElem.appendChild(this._dialog);				
		//document.body.appendChild(centerElem);
		//document.body.style.display = "block";		
		document.body.appendChild(this._dialog);		
		widgetposition = document.documentElement ? ((document.documentElement.clientWidth == 0 ) ? document.body.clientWidth : document.documentElement.clientWidth ) : window.innerWidth;
		var widgetposition = (widgetposition/2) - 200;
		this._dialog.style.left = widgetposition + "px";		
		this._frame = document.getElementById('jvwidgetcontent').contentWindow;
		var w = this._dialog.clientWidth + 20;
		var h = this._dialog.clientHeight;
		h += 100;
		if (hh > 100)
		{
			var scrollTop = document.documentElement.scrollTop;
			if (!scrollTop)
				scrollTop = document.body.scrollTop;
			var scrollLeft = document.documentElement.scrollLeft;
			if (!scrollLeft)
				scrollLeft = document.body.scrollLeft;
			this._overlayx -= w / 2;
			if (this._overlayx + w > ww + scrollLeft)
				this._overlayx = ww + scrollLeft - w;
			if (this._overlayx < scrollLeft)
			{
				this._overlayx = scrollLeft + 20;
				if (this._overlayx + w > ww + scrollLeft)
					this._overlayx = scrollLeft;
			}
			if (this._overlayy + h > hh + scrollTop)
				this._overlayy = hh + scrollTop - h;
			if (this._overlayy < scrollTop)
				this._overlayy = scrollTop;
		}		
		//this._dialog.style.left = this._overlayx + 'px';
		this._dialog.style.top = this._overlayy + 'px';
		var o = document.getElementById('jvwidgetheader');
		if (o)
		{			
			o.onmousedown = this.startmove;
			o.onmouseup = this.endmove;
						
		}
		var maintable = document.getElementById('maintable');
		
		if (maintable)
		{			
			
			if (maintable.clientHeight == 0 && maintable.firstChild)
				maintable = maintable.firstChild;
			var position = new jvposition(null);
			position.calculatePosition(maintable);
			var o = document.createElement('div');
			o.innerHTML = '<table id="jvwidgetpopupalltable"><tr><td>&nbsp;</td></tr></table>'
			o.id = 'jvwidgetoverlayall';
			o.className = 'jvwidgetpopupcssall';
			document.body.appendChild(o);
			o.style.top = position._y + 'px';
			o.style.left = position._x + 'px';
			this._overlaytablex = position._x;
			o = document.getElementById('jvwidgetpopupalltable');
			o.style.height = maintable.clientHeight + 'px';
			o.style.width = maintable.clientWidth + 'px';
			document.body.style.backgroundColor = '#666666';
			if (typeof(document.body.onresize) == 'object')
			{
				this._overlaysaveonresize = document.body.onresize;
				document.body.onresize = this.overlayonresize;
			}
			else
				this._overlaytimer = window.setInterval(this.overlayonresize, 1000);
		}
		else if (false)
		{
			// Do this only if not in iframe?
			var width = window.innerWidth;
			var height = window.innerHeight;
			if (!width)
				width = document.documentElement.clientWidth;
			if (!height)
				height = document.documentElement.clientHeight;
			if (!width)
				width = document.body.clientWidth;
			if (!height)
				height = document.body.clientHeight;
			var o = document.createElement('div');
			o.innerHTML = '<table id="jvwidgetpopupalltable"><tr><td>&nbsp;</td></tr></table>'
			o.id = 'jvwidgetoverlayall';
			o.className = 'jvwidgetpopupcssall';
			document.body.appendChild(o);
			o.style.top = '0px';
			o.style.left = '0px';
			o = document.getElementById('jvwidgetpopupalltable');
			o.style.width = width + 'px';
			o.style.height = height + 'px';
		}
					
		if (o)		
			position.calculatePosition(o);			
		//this._overlayx = position._x;		
		//this._overlayy = position._y;
		this._overlayx = parseInt ( this._dialog.style.left );		
		this._overlayy = parseInt(this._dialog.style.top) + 10;
				
	},
	stopEventBubble: function( evt ){
			if(!evt)return;
			evt.cancelBubble = true;
			if(evt.stopPropogation){
				evt.stopPropagation();
			}
	},	
	overlayonresize : function()
	{
		jvwidget.overlayonresize2();
	},
	overlayonresize2 : function()
	{
		var maintable = document.getElementById('maintable');
		if (maintable.clientHeight == 0 && maintable.firstChild)
			maintable = maintable.firstChild;
		var x = this._overlaytablex;
		var position = new jvposition(null);
		position.calculatePosition(maintable);
		this._overlaytablex = position._x;
		var offset = x - position._x;
		if (offset)
		{
			var o = document.getElementById('jvwidgetoverlayall');
			if (o)
				o.style.left = this._overlaytablex + 'px';
		}
	},
	close : function()
	{
		document.onmousemove = this._onmousemove;
		this._onmousemove = null;
		if (this._dialog)
			this._dialog.parentNode.removeChild(this._dialog);
		this._dialog = null;
		var o = document.getElementById('jvwidgetoverlayall');
		if (o)
		{
			o.parentNode.removeChild(o);
			document.body.style.backgroundColor = '#cccccc';
		}
		if (this._timer)
		{
			window.clearTimeout(this._timer);
			this._timer = null;
		}
		if (this._onclose)
			this._onclose();
		if (typeof(track) == 'function')
			track();
	},	
	startmove : function(e)
	{		
		var evt = e ? e: window.event;		
		var elem = evt.target ? evt.target : evt.srcElement;
		if( elem.id == "jv_widgetClose")
			return;   // as we dont want the widget to move when there is a move on the close img.			
		if(evt.target)
		var scrollLeft = document.documentElement.scrollLeft;
		if (!scrollLeft)
			scrollLeft = document.body.scrollLeft;
		var scrollTop = document.documentElement.scrollTop;
		if (!scrollTop)
			scrollTop = document.body.scrollTop;		
		// The jvwidget._overlayx and overlayy are off somehow for the initial click. Settle them.
		jvwidget._offsetx = jvwidget._overlayx - scrollLeft - jvwidget._x;
		jvwidget._offsety = jvwidget._overlayy - scrollTop - jvwidget._y;
		
		jvwidget._isMoving = true;
		return false;
	},
	endmove : function(e)
	{
		jvwidget._isMoving = false;
		return false;
	},
	onmousemove : function(e)
	{
		
		var scrollLeft = document.documentElement.scrollLeft;
		if (!scrollLeft)
			scrollLeft = document.body.scrollLeft;
		var scrollTop = document.documentElement.scrollTop;
		if (!scrollTop)
			scrollTop = document.body.scrollTop;
		jvwidget._x = (window.Event && e) ? e.pageX - scrollLeft : event.clientX;
		jvwidget._y = (window.Event && e) ? e.pageY - scrollTop : event.clientY;
		if (jvwidget._isMoving)
		{
			var scrollLeft = document.documentElement.scrollLeft;
			if (!scrollLeft)
				scrollLeft = document.body.scrollLeft;
			var scrollTop = document.documentElement.scrollTop;
			if (!scrollTop)
				scrollTop = document.body.scrollTop;
			var hh = window.innerHeight;
			if (!hh)
				hh = document.body.clientHeight;
			var o = jvwidget._dialog.style;
			// Debug for IE jvwidget._offsetx is getting the value as "NaN"			
			jvwidget._overlayx = scrollLeft + jvwidget._x + jvwidget._offsetx;
			jvwidget._overlayy = scrollTop + jvwidget._y + jvwidget._offsety;
			var width = document.body.clientWidth;
			var height = document.body.clientHeight;
			if (jvwidget._overlayx + jvwidget._dialog.clientWidth > width)
				jvwidget._overlayx = width - jvwidget._dialog.clientWidth;
			if (jvwidget._overlayy + jvwidget._dialog.clientHeight > height + scrollTop)
				jvwidget._overlayy = height - jvwidget._dialog.clientHeight + scrollTop;
			if (jvwidget._overlayx < 0)
				jvwidget._overlayx = 0;
			if (jvwidget._overlayy < 0)
				jvwidget._overlayy = 0;						
			o.left = jvwidget._overlayx + 'px';
			o.top = jvwidget._overlayy + 'px';
			if (jvwidget._y + jvwidget._dialog.clientHeight > hh - 20)
				window.scrollBy(0, jvwidget._y - hh - jvwidget._dialog.clientHeight + 20);
			else if (jvwidget._y < 20)
				window.scrollBy(0, jvwidget._y - 20);
			return false;
		}
		return true;
	},
	buttonexpand : function(o, userId, jobIds, messageId, companyId, hasemployees, jobboard)
	{		
		if (document.getElementById('jvbuttonexpanded'))
			return;
		jvwidget._object = o;
		jvwidget._userId = userId;
		jvwidget._jobIds = jobIds;
		jvwidget._messageId = messageId;
		jvwidget._companyId = companyId;
		jvwidget._hasemployees = hasemployees;
		jvwidget._jobboard = jobboard;
		var e = document.createElement('div');
		e.id = 'jvbuttonexpanded';
		o.parentNode.previousSibling.appendChild(e);
		e.style.position = 'absolute';
		e.style.zIndex = 100;
		e.style.left = '0px';
		e.style.top = '0px';
		e.style.height = '51px';
		e.style.width = '155px';
		e.style.marginLeft = '0px';
		e.style.paddingLeft = '0px';
		e.style.textAlign = 'left';
		e.style.backgroundColor = 'Transparent';
		jvwidget._onmousemove = document.onmousemove;
		document.onmousemove = jvwidget.buttonmousemove;
		e.innerHTML =
			'<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 0px; padding-left: 0px; width: 100px; padding: 0px 0px 0px 0px; background-color: Transparent;">' +
			'<tr height="20"><td colspan="7" height="20" style="background-color: Transparent;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="16" height="20" /></td></tr>' +
			'<tr>' +
			'<td style="width: 8px; padding: 0px 0px 0px 0px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/lftJVLinkOver.png" /></td>' +
			'<td valign="top" style="text-align: center; vertical-align: top; padding-top: 1px; background-image: url(' + jvwidgetbaseurl + 'images2/Widget/ctrJVLinkOver.png); background-repeat: repeat-x;"><table cellpadding="0" cellspacing="0" border="0" style="margin: 0px 0px 0px 0px;">' +
			'<tr>' +
			'<td style="padding: 7px 0px 0px 0px; line-height: 12px; font-size: 12px;" class="jvwidgetbuttontext" align="left" width="40">Share</td>' +
			'<td style="padding: 7px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Facebook16.png" title="Send a Jobvite to your Facebook friends. Or Jobvite people by posting to your wall or updating your status" onclick="jvwidget.buttonprocess(\'Facebook\')" /></td>' +
			'<td style="padding: 7px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/LinkedIn16.png" title="Send a Jobvite to LinkedIn contacts" onclick="jvwidget.buttonprocess(\'LinkedIn\')" /></td>' +
			'<td style="padding: 7px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Twitter16.png" title="Tweet a Jobvite" onclick="jvwidget.buttonprocess(\'Twitter\')" src="' + jvwidgetbaseurl + 'images2/Widget/Twitter Icon.png" /></td>' +
			'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +
			'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +
			'</tr>' +
			'<tr>' +
			'<td style="padding: 7px 0px 0px 0px; background-color: White; line-height: 12px; font-size: 12px;" class="jvwidgetbuttontext" align="left" width="40">Email</td>' +
			'<td style="padding: 7px 0px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Email16.png" title="Enter email address to send a Jobvite" onclick="jvwidget.buttonprocess(\'Email\')" /></td>' +
			'<td style="padding: 7px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Outlook16.png" title="Send a Jobvite to Outlook contacts" onclick="jvwidget.buttonprocess(\'Outlook\')" /></td>' +
//			'<td style="padding: 7px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Yahoo16.png" title="Send a Jobvite to Yahoo! mail contacts" onclick="jvwidget.buttonprocess(\'Yahoo\')" /></td>' +
			'<td style="padding: 7px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Gmail16.png" title="Send a Jobvite to Gmail contacts" onclick="jvwidget.buttonprocess(\'Gmail\')" /></td>' +
			'<td style="padding: 7px 1px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Hotmail16.png" title="Send a Jobvite to Hotmail contacts" onclick="jvwidget.buttonprocess(\'Hotmail\')" /></td>' +
			'<td style="padding: 7px 1px 0px 0px; background-color: White;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +	// Remove when enabling Yahoo
			'</tr>' +
			'</table></td>' +
			'<td style="width: 9px; padding: 0px 0px 0px 0px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/rgtJVLinkOver.png" /></td>' +
			'</tr>' +
			'</table>';
	},
	buttonmousemove : function(e)
	{
		var o = (window.Event && e ? e.target : event.srcElement);
		var n = o;
		while (o && o.id != 'jvbuttonexpanded' && o.className != 'jvwidgetbuttontable')
			o = o.parentNode;
		if (!o)
		{
			o = document.getElementById('jvbuttonexpanded');
			if (o)
			{
				o.parentNode.removeChild(o);
				document.onmousemove = jvwidget._onmousemove;
				jvwidget._onmousemove = null;
				if (jvwidget._onclose)
					jvwidget._onclose();
			}
		}
	},
	buttonprocess : function(s)
	{		
		var o = document.getElementById('jvbuttonexpanded');
		if (o)
		{
			o.parentNode.removeChild(o);
			document.onmousemove = jvwidget._onmousemove;
			jvwidget._onmousemove = null;
		}		
		jvwidget.open(jvwidget._object, jvwidget._userId, jvwidget._jobIds, jvwidget._messageId, jvwidget._companyId, jvwidget._hasemployees, s);
	},
	buttonprocess2 : function(s, o, userId, jobIds, messageId, companyId, hasemployees, jobboard)
	{		
		jvwidget._object = o;
		jvwidget._userId = userId;
		jvwidget._jobIds = jobIds;
		jvwidget._messageId = messageId;
		jvwidget._companyId = companyId;
		jvwidget._hasemployees = hasemployees;
		jvwidget._jobboard = jobboard;
		jvwidget.open(jvwidget._object, jvwidget._userId, jvwidget._jobIds, jvwidget._messageId, jvwidget._companyId, jvwidget._hasemployees, s);
	},
	buttonprocess3 : function(s, o, userId, jobIds, messageId, companyId, hasemployees, jobboard)
	{
		if (o)
			o.scrollIntoView(false);
		jvwidget._object = o;
		jvwidget._userId = userId;
		jvwidget._jobIds = jobIds;
		jvwidget._messageId = messageId;
		jvwidget._companyId = companyId;
		jvwidget._hasemployees = hasemployees;
		jvwidget._jobboard = jobboard;
		window.setTimeout('jvwidget.open(jvwidget._object, jvwidget._userId, jvwidget._jobIds, jvwidget._messageId, jvwidget._companyId, jvwidget._hasemployees, ' + '\'' + s + '\')', 50);
	},
	writebutton : function(userId, jobIds, messageId, companyId, hasemployees, noloop, showoptions, callback)
	{
		if (typeof(jvinitiate) != 'string')
		{
			jvinitiate = '';
			var l = window.location.href;
			var p = l.indexOf('?initiate=');
			if (p == -1)
				p = l.indexOf('&initiate=');
			if (p != -1)
			{
				p += 10;
				var p2 = l.indexOf('&', p);
				if (p2 == -1)
					p2 = l.length;
				jvinitiate = l.substring(p, p2);
			}
		}
		var jobboard = '';
		var l = window.location.href;
		var p = l.indexOf('?s=');
		if (p == -1)
			p = l.indexOf('&s=');
		if (p != -1)
		{
			p += 3;
			var p2 = l.indexOf('&', p);
			if (p2 == -1)
				p2 = l.length;
			jobboard = l.substring(p, p2).replace(/'\''/g,'\\\'');
		}
		var initiate = jvinitiate.split('-');
		var id = (initiate.length > 1 && '[\'' + initiate[1] + '\']' == jobIds ? ' id="jvinitiateobject"' : '');
		if (showoptions)
		{
			var f = (callback ? callback : 'jvwidget.buttonprocess2');
			document.writeln(
				'<table ' + id + 'cellpadding="0" cellspacing="0" border="0" style="margin-left: 0px; padding-left: 0px; width: 100px; padding: 0px 0px 0px 0px; background-color: Transparent;">' +
				'<tr>' +
				'<td style="width: 8px; padding: 0px 0px 0px 0px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/lftcareersite.png" /></td>' +
				'<td valign="top" style="text-align: center; vertical-align: top; padding-top: 1px; background-image: url(' + jvwidgetbaseurl + 'images2/Widget/ctrcareersite.png); background-repeat: repeat-x;"><table cellpadding="0" cellspacing="0" border="0" style="margin: 0px 0px 0px 0px;">' +
				'<tr>' +
				'<td colspan="' + (hasemployees ? 8 : 6) + '">' +
				'<table cellpadding="0" cellspacing="0" border="0">' +
				'<tr>' +
				'<td style="vertical-align: bottom; width: 16px; padding: 1px 0px 0px 0px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/Jobvite-favicon-14x14.gif" width="16" height="16"></td>' +
				'<td style="vertical-align: bottom; padding: 1px 3px 0px 0px;"><span class="jvwidgetbuttonlink" style="color: #666666;">Send Jobvite</span></td>' +
				'</tr>' +
				'</table>' +
				'</td>' +
				'</tr>' +
				'<tr>' +
				'<td style="padding: 2px 0px 0px 0px; line-height: 12px; font-size: 12px;" class="jvwidgetbuttontext" align="left" width="40">Share</td>' +
				'<td style="padding: 2px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Facebook16.png" title="Send a Jobvite to your Facebook friends. Or Jobvite people by posting to your wall or updating your status" onclick="' + f + '(\'Facebook\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				'<td style="padding: 2px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/LinkedIn16.png" title="Send a Jobvite to LinkedIn contacts" onclick="' + f + '(\'LinkedIn\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				'<td style="padding: 2px 3px 0px 0px;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Twitter16.png" title="Tweet a Jobvite" onclick="' + f + '(\'Twitter\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" src="' + jvwidgetbaseurl + 'images2/Widget/Twitter Icon.png" /></td>' +
				'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +
				'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +
				(hasemployees ?
					'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>' +
					'<td><img src="' + jvwidgetbaseurl + 'images2/spix.gif" /></td>'
					: '') +
				'</tr>' +
				'<tr>' +
				'<td style="padding: 2px 0px 0px 0px; background-color: White; line-height: 12px; font-size: 12px;" class="jvwidgetbuttontext" align="left" width="40">Email</td>' +
				'<td style="padding: 2px 0px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Email16.png" title="Enter email address to send a Jobvite" onclick="' + f + '(\'Email\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				'<td style="padding: 2px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Outlook16.png" title="Send a Jobvite to Outlook contacts" onclick="' + f + '(\'Outlook\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
//				'<td style="padding: 2px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Yahoo16.png" title="Send a Jobvite to Yahoo! mail contacts" onclick="' + f + '(\'Yahoo\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				'<td style="padding: 2px 3px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Gmail16.png" title="Send a Jobvite to Gmail contacts" onclick="' + f + '(\'Gmail\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				'<td style="padding: 2px 1px 0px 0px; background-color: White;"><img style="cursor: pointer;" src="' + jvwidgetbaseurl + 'images2/Widget/Hotmail16.png" title="Send a Jobvite to Hotmail contacts" onclick="' + f + '(\'Hotmail\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')" /></td>' +
				(hasemployees ?
					'<td style="padding: 2px 3px 0px 0px; background-color: White; width: 16px; text-align: center; cursor: pointer; color:#0066cc; font-weight: bold;" title="Send a Jobvite to contacts" onclick="' + f + '(\'Contacts\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')">C</td>' +
					'<td style="padding: 2px 3px 0px 0px; background-color: White; width: 16px; text-align: center; cursor: pointer; color:#0066cc; font-weight: bold;" title="Send a Jobvite to employees" onclick="' + f + '(\'Employees\', this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')">E</td>'
					: '') +
				'<td style="padding: 2px 1px 0px 0px; background-color: White;"><img src="' + jvwidgetbaseurl + 'images2/spix.gif" width="16" /></td>' + // Remove when enabling Yahoo
				'</tr>' +
				'</table></td>' +
				'<td style="width: 9px; padding: 0px 0px 0px 0px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/rgtcareersite.png" /></td>' +
				'</tr>' +
				'</table>');
			if (id.length)
				window.setTimeout(f + '(\'Outlook\', document.getElementById(\'jvinitiateobject\'), \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')', 50);
		}
		else
		{
			document.writeln(
				'<div style="position: relative;"></div><div class="jvwidgetbuttontable">' +
				'<table ' + id + 'cellpadding="0" cellspacing="0" border="0" onmouseover="jvwidget.buttonexpand(this, \'' + userId + '\', ' + jobIds + ', \''+messageId+'\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')">' +
				'<tr>' +
				'<td style="vertical-align: bottom; width: 16px; padding: 3px 3px 3px 3px;"><img src="' + jvwidgetbaseurl + 'images2/Widget/WidgetAnimated16' + (noloop ? 'NoLoop' : '') + '.gif" width="16" height="16"></td>' +
				'<td style="vertical-align: bottom; padding: 3px 3px 3px 0px;"><a href="javascript:void(0)" class="jvwidgetbuttonlink">Send Jobvite</a></td>' +
				'</tr>' +
				'</table>' +
				'</div>');
			if (id.length)
				window.setTimeout('jvwidget.buttonprocess2(\'Outlook\', document.getElementById(\'jvinitiateobject\'), \'' + userId + '\', ' + jobIds + ', \'' + messageId + '\', \'' + companyId + '\', ' + hasemployees + ', \'' + jobboard + '\')', 50);
		}
	},
	
	loginFacebook : function()
	{
		jvwidget._connected = false;
		if (this._Facebookprofile)
		{
			jvwidget.out('ifUserConnected');
			var me = this;
			//FB.Connect.ifUserConnected(this.importfromFacebook, this.connecttoFacebook);
			FB.getLoginStatus(function(response) {
			  if (response.authResponse) {
			    // logged in and connected user, someone you know
				me.importfromFacebook(response.authResponse);
			  } else {
			    // no user session available, someone you dont know
				me.connecttoFacebook();
			  }
			});
		}
		else
		{		    
			jvwidget.out('widgetgetFacebookkey');
			if(typeof jvwidget.FACEBOOK_KEY != "undefined"){
				jvwidgetAPIExecute('widgetgetsocialprofile', 'Facebook', jvwidget.ongetFacebookprofile);
			}else{
				jvwidgetAPIExecute('widgetgetFacebookkey', '', this.ongetFacebookkey);	
			}
			
		}
	},
	ongetFacebookkey : function(args)
	{
		jvwidget.out('ongetFacebookkey');
	    //raj adding for ssl sites..load the right xd_receiver.htm
	    var pos = jvwidgetbaseurl.indexOf('https') 
		//window.fbAsyncInit = function() {
		  FB.init(
		  	{appId: args+'', 
			status: true, 
			cookie: true,
		    xfbml: true,
			oauth: true
		});
		setTimeout(function(){
			jvwidgetAPIExecute('widgetgetsocialprofile', 'Facebook', jvwidget.ongetFacebookprofile);	
		}, 100)
		
		//};
//	    if(pos >= 0)
//	    {
//                FB.init(args, jvwidgetbaseurl + 'xd_receiver_ssl.htm');
//        }
//		else
//		{
//                FB.init(args, jvwidgetbaseurl + 'xd_receiver.htm');
//		}
//        FB.ensureInit(function() { 
//            jvwidgetAPIExecute('widgetgetsocialprofile', 'Facebook', jvwidget.ongetFacebookprofile);
//        }); 
		
	},
	ongetFacebookprofile : function(args)
	{
		jvwidget.out('ongetFacebookprofile');
		jvwidget.out(args);
		if (args.length){
			this._Facebookprofile = eval('(' + args + ')');
			jvwidget.out('ifUserConnected');
			session =  FB.getAuthResponse();
			if(session == null ){
				//backend has reference to the profile. get it from there. 
				session = this._Facebookprofile;
				session.accessToken = this._Facebookprofile.secretKey;
			}
			var fb_response = {};
			fb_response.authResponse = session;
			jvwidget.importfromFacebook(fb_response);
		}else{
			jvwidget.connecttoFacebook();
		}
//		try
//		{
//			FB.Connect.ifUserConnected(jvwidget.importfromFacebook, jvwidget.connecttoFacebook);
//		}
//		catch (e)
//		{
//			jvwidget._frame.jvwidget.errorshow('Could not connect to Facebook');
//		}
	},
	connecttoFacebook : function()
	{
		jvwidget.out('connecttoFacebook');
        jvwidget._connected = false; 
		// trigger the call here to connect to facebook.
		try{
			FB.login(function(response) {
		  if (response.authResponse) {
		      // user is logged in and granted some permissions.
			  jvwidget.importfromFacebook(response);
		  } else {
		    // User cancelled login or did not fully authorize.
			jvwidget._frame.jvwidget.errorshow('Could not connect to Facebook');
		  }
		}, {scope:'publish_stream,offline_access,friends_work_history,friends_education_history,friends_location'});	
		}catch(e){
			if(getInternetExplorerVersion() == -1){
				jvwidget._frame.jvwidget.showstartpage();
				alert("Please Enable Popups And Try Again")	
			}
		}
		//FB.Connect.requireSession(jvwidget.importfromFacebook);
	},
	importfromFacebook : function(fb_response)
	{  
		jvwidget.out('importfromFacebook');
		jvwidget.out(jvwidget._connected);
		if (jvwidget._connected)
		{
			return;
        }
		jvwidget._connected = true;
		var session = null; 
			session = fb_response.authResponse 
        if(session == null && jvwidget._connected)
    	{
			//VA: instead of showing the error let the use log in again.
            //jvwidget._frame.displayRestartFBSessionMessage();
    	}
    	else
    		jvwidget.continueImportFromFacebook(session);
	},
	continueImportFromFacebook : function(session)
	{
//	    if (session.expires == 0)
//	        jvwidget.continueImportFromFacebook3(session);
//	    else{
//			try{
//				FB.Connect.showPermissionDialog('offline_access', jvwidget.continueImportFromFacebook2);	
//			}
//			catch( e ){
//				// There is a bug related to firebug and firefox and throws exceptions.
//				//http://bugs.developers.facebook.com/show_bug.cgi?id=5252				 
//			}
//			
//		}
		jvwidget.continueImportFromFacebook2(session);
	        
	},
	continueImportFromFacebook2 : function(session)
	{
//	    var session = FB.Facebook.apiClient.get_session();
	    jvwidget.continueImportFromFacebook3(session);
	},
	
	continueImportFromFacebook3: function(session) {
	    //var sessionKey = session.session_key;
		//var sessionKey = session.accessToken;
	    jvwidget._frame.jvwidget.continueImportFromFacebook(session);
	},
	//VA: Not using?
	/*
	postToWall: function(templateId, comment_data, callback)
	{
		try{
			FB.Connect.showFeedDialog(templateId, comment_data, null, null, FB.FeedStorySize.shortStory, FB.RequireConnect.promptConnect, callback);	
		}
		catch( e ){
			// There is a bug related to firebug and firefox and throws exceptions
			//http://bugs.developers.facebook.com/show_bug.cgi?id=5252			
		}
    },
    */
    postToWallStreamPublish: function(message, jobTitle, briefDescription, imageSource, destination, callback ) {
		/*
        var attachment = { 'media':
    	                    [{ 'type': 'image',
    	                        'src': imageSource,
    	                        'href': destination
                             }],
                            'caption': 'Shared via Jobvite',
                            'description': briefDescription,
                            'name': jobTitle,
                            'href': destination
                        };
    var actionLinks = [{ 'text': 'Apply or Share',
        'href': destination}];
        FB.Connect.streamPublish(message, attachment, actionLinks, null, 'Share this job', callback);
		*/
		/*
			FB.ui(
	       {
	         method: 'stream.publish',
	         message: message,
	         attachment: {
	           name: jobTitle,
	           caption: 'Shared via Jobvite',
	           description: (
	             briefDescription
	           ),
	           href: destination
	         },
	         action_links: [
	           { text: 'Apply or Share', href:destination }
	         ],
	         user_prompt_message: 'Share Jobvite'
	       },
	       function(response) {
	         if (response && response.post_id) {
	           callback( response);
	         } else {
	           jvwidget._frame.jvwidget.errorshow('Post was not published.');
	         }
	       }
	     ); 
		 
		 */
		 var params = {};
		params['message'] = message;
		params['name'] = jobTitle;
		params['description'] = briefDescription;
		params['link'] = destination;
		params['picture'] = imageSource;
		params['caption'] = 'Shared via Jobvite';
		  
		FB.api('/me/feed', 'post', params, function(response) {
		  if (!response || response.error) {
		    jvwidget._frame.jvwidget.errorshow('Unable to Post.');
		  } else {
		  	callback( response);
		  }
		});
    },
	
	
	updateFacebookStatus : function()
	{
		//VA: with new api we dont need to take the backend help if the user has given permissions. We ask those before hand only
//		var session = FB.Facebook.apiClient.get_session();
//		jvwidgetAPIExecute('widgethasupdatepermissions', 'Facebook\n' + session.uid + '\n' + session.session_key, jvwidget.onhasupdatepermissions);
		var args = "OK";
		jvwidget.onhasupdatepermissions(args);
	},
	
	onhasupdatepermissions : function(args)
	{
		if (args == 'OK'){
			jvwidget.updateFBstatus();
		}
		else{
			// VA: Not needed any more as we ask for the permission before hand.
			jvwidget.continueUpdateFBStatus(args);
		}
	},
	/*
	continueUpdateFBStatus : function(args)
	{
		try{
			FB.Connect.showPermissionDialog("status_update", function(accepted) { 
				if(accepted.toString() == "true")
					jvwidget.updateFBstatus();
				else
				{
	                jvwidget._frame.jvwidget.errorshow("You did not grant permissions.Your facebook status will not be updated");
	            }
			});	
		}
		catch( e ){
			// There is a bug related to firebug and firefox and throws exceptions
			//http://bugs.developers.facebook.com/show_bug.cgi?id=5252
		}
		
	},
	*/  
	updateFBstatus : function()
	{
		var session = jvwidget.getFBsession();
		jvwidget._frame.jvwidget.updateFBstatus(session);
	},
	getFBsession : function()
	{
		return FB.getAuthResponse();
	},
	out : function(s)
	{
		var o = document.getElementById('jvmessage');
		if (o)
			o.innerHTML += s + '<br>';
	},
		
	updateLinkedInStatusSuccess: function(){
		alert("successful");	
	}
}
var jvwidget = new jvwidgetclass();
window.fbAsyncInit = function() {
		_func = function(args){
			if( args !== null && typeof args != "undefined" && args !=""){
				FB.init({
					appId: args, 
					status: true, 
					cookie: true,
		    		//xfbml: true,
					oauth: true
				});
				jvwidget.FACEBOOK_KEY = args;	
			}		
		}
		jvwidgetAPIExecute('widgetgetFacebookkey', '',_func);
}

