function ViewPrint(str){
  window.open(str,"printPage",'top='+(screen.height-520)/2+',left='+(screen.width-540)/2+',width=540,height=520,scrollbars=Yes,status=no,toolbar=no,menubar=no,location=no,resizable=no,titlebar=no')
}

function hide(n){
if(document.all['tempq'].value!=""){
   if(document.all['tempq'].value==n){
     document.all['d'+n].style.display=="none"
   }else{
       document.all['d'+document.all['tempq'].value].style.display="none"
   }
}

if(document.all['d'+n].style.display=="none"){
	document.all['d'+n].style.display="";
	document.all['tempq'].value = n;
}else{
  document.all['d'+n].style.display="none"}	
}

function key3(){
if (event.keyCode <= 46 || event.keyCode > 57 || event.keyCode == 47){event.returnValue = false;}
}

function SendToFriend(){
   var pEmail = document.formi2.Email.value
   
   document.formi2.sendi.value = document.formi2.whatoff.value
   document.formi2.sendi.disabled = true
  
   var url="AjaxSendToFriend.asp?sid=" + Math.random() + "&Email=" + escape(pEmail)
   xmlHttp=GetXmlHttpObjectSubject(getSendToFriend)
   xmlHttp.open("GET", url , false)
   xmlHttp.send(null)
   return false
}

function getSendToFriend(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	  pResults = xmlHttp.responseText
	  
	  if(pResults=="ok"){
	    alert(document.formi2.after.value)
		document.formi2.Email.value = ""
		document.formi2.sendi.value = document.formi2.whaton.value
        document.formi2.sendi.disabled = false
	  }else{
	  
		alert(document.formi.tit.value+"\n"+pResults)
		document.formi2.Email.value = ""
		document.formi2.sendi.value = document.formi2.whaton.value
        document.formi2.sendi.disabled = false
	  }
	  
	  return false
	  
	}
}

function Joini(){
  var pNamei = document.formi.Namei.value
  var pIdent = document.formi.Ident.value
  var pAddress = document.formi.Address.value
  var pEmail = document.formi.Email.value
  var pPhone = document.formi.Phone.value
  
  document.formi.sendi.value = document.formi.whatoff.value
  document.formi.sendi.disabled = true
  
  var url="AjaxPetition.asp?sid=" + Math.random() + "&Namei=" + escape(pNamei) + "&Ident=" + escape(pIdent) + "&Address=" + escape(pAddress) + "&Email=" + escape(pEmail) + "&Phone=" + escape(pPhone)
  xmlHttp=GetXmlHttpObjectSubject(getJoini)
  xmlHttp.open("GET", url , false)
  xmlHttp.send(null)
  return false

}

function getJoini(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
	  pResults = xmlHttp.responseText
	  
	  if(pResults=="ok"){
	    alert(document.formi.after.value)
		document.location = "../site"
	  }else{
	  
	    pResultsEnd = pResults.replace(/MICO/, "\n")	
		pResultsEnd = pResultsEnd.replace(/MICO/, "\n")	
		pResultsEnd = pResultsEnd.replace(/MICO/, "\n")	
		pResultsEnd = pResultsEnd.replace(/MICO/, "\n")	
		
		alert(document.formi.tit.value+"\n"+pResultsEnd)
		document.formi.sendi.value = document.formi.whaton.value
        document.formi.sendi.disabled = false
	  }
	  
	  return false
	  
	}
}


function GetXmlHttpObjectSubject(handler)
{ 
var objXmlHttp=null

//if (navigator.userAgent.indexOf("Opera")>=0)
//{
//alert("This script doesn't work in Opera") 
//return 
//}
if (navigator.userAgent.indexOf("MSIE")>=0)
{ 
var strName="Msxml2.XMLHTTP"
if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
{
strName="Microsoft.XMLHTTP"
} 
try
{ 
objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler 
return objXmlHttp
} 
catch(e)
{ 
alert("Error. Scripting for ActiveX might be disabled") 
return 
} 
} 

//if (navigator.userAgent.indexOf("Mozilla")>=0||navigator.userAgent.indexOf("Opera")>=0)
//{
objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler 
return objXmlHttp
//}
}

