Files
jasoc.org/archive/version_02/jairus.js
2017-03-02 21:32:16 -06:00

127 lines
4.0 KiB
JavaScript
Executable File

// JavaScript Document for Jairus Society : english
if( document.images )
{
var home_btn = PreLoad( 'home' );
var ourmission_btn = PreLoad( 'ourmission' );
var ourfamilies_btn = PreLoad( 'ourfamilies' );
var support_btn = PreLoad( 'support' );
var legal_btn = PreLoad( 'legal' );
var contactus_btn = PreLoad( 'contactus' );
var guestbook_btn = PreLoad( 'guestbook' );
var links_btn = PreLoad( 'links' );
var zuruck_btn = PreLoad( 'zuruck' );
}
function PreLoad( btn )
{
var loc_pattern = /.*\/(ourfamilies|familien)\//;
var img_path = "./graphics/"; //file path to find button images
if( loc_pattern.test( document.location ) ) { img_path = "../graphics/"; }
var temp = new Array();
temp[ 0 ] = new Image(); //don't know which image we're actually loading
temp[ 1 ] = new Image(); //so format temp to hold an image, any image
//then we can use .src to load each button img
temp[ 0 ].src = img_path + btn + "_btn" + ".gif"; //first version: no mouse over image
temp[ 1 ].src = img_path + btn + "_btn_2" + ".gif"; //second version: mouse over image
return temp;
}
function Swap( img, mouse_on )
{
if( document.images )
{
var image_id = img + "_btn";
var temp = eval( img + "_btn" );
document[ image_id ].src = temp[ mouse_on ].src;
}
}
function Enlarge_Picture( link, language )
{
link = link.replace( "thumb_", "" );
link = "../picture.htm?id=" + link + "+lang=" + language;
var loc_pattern = /.*\/(ourfamilies|familien)\//;
if( loc_pattern.test( document.location ) ) { link = "../" + link; }
window.open( link, "_blank", "width=400, height=400, scrollbars=no, resizable=yes" );
}
function Random_Picture( where, placement )
{
var loc_pattern = /.*\/ourfamilies\//;
var img_path = ".";
if( loc_pattern.test( document.location ) ) { img_path = "../."; }
var doc_loc = document.location;
var lang_pattern = /.*\/(en|de)\/.*/;
lang_pattern.test(doc_loc);
var language = RegExp.$1;
var random_num = Math.round( Math.random() * 1000 );
random_num = random_num % (num_images + 1);
if( random_num == 0 ) { random_num = 1; }
var random_img = eval( "image_" + random_num );
if( where == "header" ) { document.write( "<img src=\"" + img_path + random_img + "\" id=\"random_img\" align=\"right\" height=\"180\" />" ); }
else if( where == "body" ) { document.write( "<img src=\"" + img_path + random_img + "\" class=\"intext_img\" align=\"" + placement + "\" onclick=\"Enlarge_Picture( this.src, \'" + language + "\' )\" />" ); }
}
function According_Caption()
{
var temp = new Array();
var c = 0;
var name_pattern = /.*\/pictures\/.*\/(.*\.\w{3})/;
name_pattern.test( document[ "picture" ].src );
for( c = 1; c <= num_images; c++ )
{
temp = eval( "caption_" + c );
if( temp[0] == RegExp.$1 )
{
if( language == "en" ) { document.write( temp[1] + "<br /> <br />" ); }
else if( language == "de" ) { document.write( temp[2] + "<br /> <br />" ); }
break;
}
}
}
function According_Link()
{
var src_pattern = /.*\/pictures\/(.*)\/.*\.\w{3}/;
src_pattern.test( document[ "picture" ].src );
var child_name = RegExp.$1;
var img_path = "";
if( language == "en" ) { img_path = "en/ourfamilies/"; link_text = "Read more about me"; }
else if( language == "de" ) { img_path = "de/familien/"; link_text = "Lese mehr über mich"; }
var loc_pattern = /.*\/ourfamilies|familien\//;
if( loc_pattern.test( document.location ) ) { img_path = "./"; }
document.write( "<a href=\"javascript:SendParent(\'" + img_path + eval( "link_" + child_name ) + "\')\" target=\"_parent\">" + link_text + "</a>" );
}
function SendParent( link_to_parent )
{
winName=window.name;
parentName=opener.location.href=link_to_parent;
opener.focus();
self.close();
}
function Check_GB_Fields()
{
if( (document.getElementById( "name" ).value == "") || (document.getElementById( "message" ).value == "") )
{
alert( "Please enter both a name AND message!!" );
return false;
}
else { return true; }
}