function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfY;
}

function OpenImage(IMG){
	
	var image = "<img src='" + IMG + "'>";
	document.getElementById('image_here').innerHTML = image;	
	document.getElementById('img_div').style.display = "block";
	
	var StyleTop = 170 + getScrollXY();
	
	if( StyleTop < 350 ){
		
		StyleTop = 350;
	}
	
	document.getElementById("img_div").style.top = StyleTop + "px";
}

function ShowHide( id ){
	
	if( document.getElementById(id).style.display == "none" ){
		
		document.getElementById(id).style.display = "block";
	}
	else{
		
		document.getElementById(id).style.display = "none";
	}
}

function ShowHideVisibility( id ){
	
	if( document.getElementById(id).style.visibility == "visible" ){
		
		document.getElementById(id).style.visibility = "visible";
	}
	else{
		
		document.getElementById(id).style.visibility = "hidden";
	}
}

function for_mozilla(id1, id2) {
	
	document.getElementById(id1).value = id2;
}
/*
function IsEmailAddress(mail){
	
	var addressPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	return addressPattern.test(mail);
}*/

function jump_to_pass(){
	
	document.getElementById('hidden_pass').value = document.getElementById('password_tmp').value;
}

function OnPasswordFocus(){
	
	document.getElementById('pass_td').innerHTML = "<input type='password' name='password_tmp' id='password_tmp' style='width:110px;'>";
	document.getElementById('password_tmp').focus();
}

function isPhoneNumber(phone){
	
	var detect;
	var CharArray = new  Array(' ', '(', ')', '+', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
	
	for( var j=0; j < phone.length; j++ ){
		
		var PhoneChar = phone.substring( j, j+1 );
		
		detect = false;
		
		for( var z=0; z < CharArray.length; z++ ){
			
			if( PhoneChar == CharArray[z] ){
				
				detect = true;
			} 
		}
		
		if(detect == false){
			
			break;
		}
	}
	
	if(phone.length<5){
		
		detect = false;
	}
	
	return detect;
}

function HideImagesInPrintVersion(){
	
	var ImagesArray = document.getElementsByTagName("img");	
	
	for( i=0; i < ImagesArray.length; i++ ){	
		
		var TheImage = ImagesArray[i];
		var TheImageId = TheImage.id;
		
		if( TheImageId.search("in_print_show") == -1 ){
			
			TheImage.style.display = "none";
		}
	}
}
