window.onload = function(){
	fixBrokenImages();	
}

/* validated login functin */
function loginVal(){
	with(document.myLoginForm) {
		if(inputUserName.value == '' || inputUserName.value == 'Email') {
			alert('Please insert your e-mail'); 
			inputUserName.focus();
			return false;
		}
		if(inputPassword.value == '' || inputPassword.value == 'password') {
			alert(' Please insert your password. '); 
			inputPassword.focus();
			return false;
		}
	}
}

/* find and replace missing images */
function fixBrokenImages(){ 
	for( i=0; i < document.images.length; i++) { 
		var img = document.images[i];
		var width = img.width; 
		if(width == 28){
			img.src = "images/main/exoh_trex.gif";
		}
	}
}


/* below are functions for the right column in index.php */
function isBlank(myObj) { 
	if(myObj.value=='') { 
		return true; 
	} 
	return false; 
}
function verifySubmitMailingList(){
	with(document.myMailingListForm){
		if(!isBlank(inputMailingListEmail)){	
		if(!isEmail(inputMailingListEmail.value)){	alert("Incorrect e-mail address format.");inputMailingListEmail.focus();return false;}
		}
		if(isBlank(inputMailingListEmail)){alert("Please enter your e-mail.");inputMailingListEmail.focus();return false;}
	}
	/* if(confirm('Are you sure to send information?')){ */
	for(i=0;i < document.myMailingListForm.inputType.length;i++){
		if(document.myMailingListForm.inputType[i].checked == true){
			var InputType = document.myMailingListForm.inputType[i].value;
		}
	}
		Popup('popupenewsWindow','pop-enews.php?inputMailingListEmail='+document.myMailingListForm.inputMailingListEmail.value+'&inputType='+InputType,380,195,0);
		document.myMailingListForm.inputMailingListEmail.value = ''
	/* } */
	return false;
}	
/* above are functions for the right column in index.php */

/* below are functions at the bottom of index.php */
function sendToClipboard(s,idSpan) {
	if( window.clipboardData && clipboardData.setData ) {
	clipboardData.setData("text", s);
	document.getElementById(idSpan).style.display='block';
	}
}
function copy_to_clipboard(text,idSpan)   
{   
document.getElementById(idSpan).style.display='block';
    if(window.clipboardData)   
    {   
    window.clipboardData.setData('text',text);   
    }   
    else  
    {   
        var clipboarddiv=document.getElementById('divclipboardswf');   
    if(clipboarddiv==null)   
    {   
       clipboarddiv=document.createElement('div');   
       clipboarddiv.setAttribute("name", "divclipboardswf");   
       clipboarddiv.setAttribute("id", "divclipboardswf");   
       document.body.appendChild(clipboarddiv);   
    }   
        clipboarddiv.innerHTML='<embed src="clipboard.swf" FlashVars="clipboard='+   
encodeURIComponent(text)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';   
    }    
    return false;   
}  
function displayLocation (Div1,client,Divwd,DivHg){  // Show Option 

            var Objleft = getposOffset(client,"left"); // get ??? x ??? object ????
            var Objtop = getposOffset(client,"top"); // get ??? y ??? object ????

            var leftPos = Objleft + client.offsetWidth -  Divwd ;
            var topPos = Objtop + DivHg + 1 ;
 
;
            document.getElementById(Div1).style.left = leftPos + 'px';
            document.getElementById(Div1).style.top = topPos + 'px';

            document.getElementById(Div1).style.display='';

}
function getposOffset(what, offsettype){
            var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
            var parentEl=what.offsetParent;
            while (parentEl!=null){
                        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
                        parentEl=parentEl.offsetParent;
            }
            return totaloffset;
}
/* above are functions at the bottom of index.php */