var addEvent = function(elem, type, eventHandle) {
	if (elem == null || elem == undefined) return;
	if ( elem.addEventListener ) {
		elem.addEventListener( type, eventHandle, false );
	} else if ( elem.attachEvent ) {
		elem.attachEvent( "on" + type, eventHandle );
	}
};

addEvent(window, "load", function() { 				
	// toggleFeedback();
	getRightOffset("wrapper", "web-survey-link");
} );

addEvent(window, "resize", function() { 				
	// toggleFeedback();
	getRightOffset("wrapper", "web-survey-link");
} );

function openWindow(obj) {
	window.open(obj.href+'?url='+window.location,'','height=400, width=400, location=0, menubar=0, resizable=0, scrollbars=0, status=0, titlebar=0' );
	return false;
}

function getRightOffset(divId, divIdFrom) {
	var position = document.getElementById(divId).clientWidth;
	var offset = document.getElementById(divId).offsetLeft;
	var offsetLeft = position + offset - 8;
	document.getElementById(divIdFrom).style.left = offsetLeft + 'px';
}

function toggleFeedback() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
  }
 // window.alert( 'Width = ' + myWidth );
 // window.alert( 'Height = ' + myHeight );
 /* hide if resolution is > 1050
 if(myWidth > 1050) {
	document.getElementById('web-survey-link').style.display = '';
 } else {
	document.getElementById('web-survey-link').style.display = 'none';
 }
 */
}

