function getPageWidth() {
  if (parent.document.body != null)
    if (parent.document.body.scrollWidth != null) 
		return parent.document.body.scrollWidth;
  if (parent.document.width != null) 
	return parent.document.width;
  return -1;
}

function getPageHeight() {
  if (parent.document.body != null)
    if (parent.document.body.scrollHeight != null) 
		return parent.document.body.scrollHeight;
  if (parent.document.height != null) 
	return parent.document.height;
  return -1;
}

function addbookmark()	{
  var bookmarkurl='http://www.teknomania.it'
  var bookmarktitle='Teknomania.it - online shopping'
  if (document.all)
  window.external.AddFavorite(bookmarkurl,bookmarktitle);
}

function ShowWin(pagina,wintarget){
	window.open(pagina,wintarget,'width=650px,height=520px,scrollbars=no,toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,left=50px,top=50px').focus();
}

function ShowWinScheda(pagina,wintarget){
	window.open(pagina,wintarget,'width=650px,height=520px,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=yes,resizable=yes,left=50px,top=50px').focus();
}


function MaximizeWin(){
	window.top.parent.focus();
}

function CloseWin(){
	window.top.parent.close();
	window.top.parent.opener.location.reload( true );
}

function Down(){
	parent.scrollTo(getPageWidth(),getPageHeight());
	Focus();
}

function Focus(){
	parent.parent.LiveHelpButton.document.getElementById('TextToSend').focus();
}

function windowLogout() {
	window.location = 'LogOutChat.aspx';
}

function writeMessage(messageText) {
var obj = parent.document.getElementById('ChatScreen');

	if( obj.insertAdjacentHTML )
		obj.insertAdjacentHTML( 'BeforeEnd', messageText );
  	
  	else if( typeof( obj.innerHTML ) != 'undefined' )
    	obj.innerHTML += messageText;
}

function eraseMessage() {
   parent.document.getElementById('ChatScreen').innerHTML = "Benvenuti...";
}
