isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
ff=isIE ? document.all.ffl : document.getElementById("ffl");
slsh=isIE ? document.all.slsh : document.getElementById("slsh");

function ss(url){
  grayOut(true);
  slsh=isIE ? document.all.slsh : document.getElementById("slsh");
  slsh.style.left = (screen.width-700)/2;
  if (isIE||isNN) slsh.style.visibility="visible";
  else if (isN4) document.slsh.visibility="show";
  document.getElementById("ssh").src = url;  
}

function cl(){
  slsh=isIE ? document.all.slsh : document.getElementById("slsh");
  if (isIE||isNN) slsh.style.visibility="hidden";
  else if (isN4) document.slsh.visibility="hide";
  grayOut(false);
  document.getElementById("ssh").src = '';    
}

function close(){
  document.mfc.message.value="";
  document.mfc.email.value="";
  hideMess();
  if (isIE||isNN) ff.style.visibility="hidden";
  else if (isN4) document.ff.visibility="hide";
  grayOut(false);  
}

function show(){
  grayOut(true);	
  ff=isIE ? document.all.ffl : document.getElementById("ffl");
  ff.style.top = (screen.height-400)/2-80;
  ff.style.left = (screen.width-500)/2;
  if (isIE||isNN) ff.style.visibility="visible";
  else if (isN4) document.ff.visibility="show";
}

function hideMess(){
  if (isIE||isNN) mess.style.visibility="hidden";
  else if (isN4) document.mess.visibility="hide";
}

function showMess(){
  if (isIE||isNN) mess.style.visibility="visible";
  else if (isN4) document.mess.visibility="show";
}


function xmlhttpPost() {
    var xmlHttpReq = false;
    var self = this;

    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', 'em.php', true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            //updatepage(self.xmlHttpReq.responseText);
            showMess();
            setTimeout("close()", 2000);
        }
    }
    self.xmlHttpReq.send("message="+document.mfc.message.value+"&from="+document.mfc.email.value);
    return true;
}
function popUp(url) {
        para = 'left='+(screen.width-678)/2+',top='+(screen.height-560)/2+',width=678,height=560';
	win = window.open(url,'mfcnw',para);
}

function cal1() {
        para = 'left='+(screen.width-800)/2+',top='+(screen.height-600)/2+',width=800,height=600,menubar=yes,scrollbars=yes,toolbar=yes';
	win = window.open('http://www.tugoz.com/2008_12Page_Scenic_Calendar','cal1',para);
}

function cal2() {
        para = 'left='+(screen.width-900)/2+',top='+(screen.height-620)/2+',width=900,height=620,menubar=yes,scrollbars=yes,toolbar=yes';
	win = window.open('http://www.tugoz.com/2008_1Page_Scenic_Calendar','cal2',para);
}

function cal3(img) {
        para = 'left='+(screen.width-900)/2+',top='+(screen.height-620)/2+',width=900,height=620,menubar=yes,scrollbars=yes,toolbar=yes';
	win = window.open(('http://www.tugoz.com/calsm.php?imagename='+img),'cal2',para);
}

function grayOut(flag) {
  var graylayer=document.getElementById('graylayer'); 	
  
  if (!graylayer) {
    var tb = document.getElementsByTagName("body")[0];
    var tn = document.createElement('div');           
    tn.style.position='absolute';                 
    tn.style.overflow='hidden';                   
    tn.style.display='none';                      
    tn.style.top='0px';                           
    tn.style.left='0px';                          
    tn.style.opacity='.7';                      
    tn.style.MozOpacity='.7';                   
    tn.style.filter='alpha(opacity=70)'; 
    tn.style.zIndex=50;        
    tn.style.backgroundColor='#000000';  
 
   if (document.body && (document.body.scrollWidth || document.body.scrollHeight)) {
        var pw = document.body.scrollWidth+'px';
        var ph = document.body.scrollHeight+'px';
    } else if(document.body.offsetWidth) {
      var pw = document.body.offsetWidth+'px';
      var ph = document.body.offsetHeight+'px';
    } else {
       var pw='100%';
       var ph='100%';
    }
        
    tn.style.width= pw;
    tn.style.height= ph;
    tn.id='graylayer'; 
                                       
    tb.appendChild(tn);                            
    graylayer=document.getElementById('graylayer');
  }
  if (flag) 
     graylayer.style.display='block';				 
  else 
     graylayer.style.display='none';
}
