function showcenterwindow(height, width, url, resize)
{

	if(isIE7())
	{
			//it'll be in a tab anyway
			window.open(url,'serviceInfo');
	}
	else
	{
	
		var popupSettings = 
		'height='+height+',width='+width+',top='+getTopCenterPosition(height)+',left='+getLeftCenterPosition(width)+',scrollbars=yes,status=no,toolbar=no';
		
		if(resize !=null && resize)
		{
			popupSettings = popupSettings+ ",resizable=yes"
		}
		else
		{
			popupSettings = popupSettings+ ",resizable=no"
		}
			
		
		
		var isopen = window.open(url,'serviceInfo',popupSettings);
		
		if(isopen == null)
		{
			alert("We have tried to open a new window and your browser has stopped it from been open\nPlease allow popups for this site");
		}
	}
}

function showcenterwindow2(height, width, url)
{
var popupSettings = 
'height='+height+',width='+width+',top='+getTopCenterPosition(height)+',left='+getLeftCenterPosition(width)+',scrollbars=yes,resizable=no,status=no,toolbar=no'
window.open(url,'serviceInfo2',popupSettings);
}

function getLeftCenterPosition(popupWidth)
{
	return Math.floor((screen.availWidth - popupWidth) / 2);
}

function getTopCenterPosition(popupHeight)
{
	return Math.floor((screen.availHeight - popupHeight) / 2);
}

function setFieldValue(fieldName, value)
{
	document.getElementById(fieldName).value = value;
}

function isIE7()
{
	var IE7 = ((document.all)&&(navigator.appVersion.indexOf("MSIE 7.")!=-1)) ? true : false;
	return IE7;
}

function limitText(limitField, limitNum) 
{
	var limitCount = document.getElementById('countdown');
	
	if (limitField.value.length > limitNum) 
	{
		limitField.value = limitField.value.substring(0, limitNum);
	} 
	else 
	{
		limitCount.value = limitNum - limitField.value.length;
	}
}

function showDialog(dialogName, size)
{
 $('#'+dialogName).dialog({
		width: size,
		modal:true,
		buttons: {
			"Ok": function() { 
				$(this).dialog("close"); 
			} 
		}
	});
}

function openLiveChat()
{
	window.open('https://livechat.feedmeonline.info/chat.php','','width=590,height=580,left=0,top=0,resizable=yes,menubar=no,location=no,status=yes,scrollbars=yes');
}


