function TANK_fsTest() {
	if (window.name!='tank_content') {
		var siteRoot = "http://www.magicomarpasha.com";
		//var siteRoot = "http://localhost/omar_pasha/";
		var siteFS = "index_fs.asp";
		var myName = location.href.substring(siteRoot.length);
		top.location.replace(siteRoot);
	}
}

// Function to open dynamically sized window in centre of the screen
var win = null;
function TANK_openWindow(url,name,imgWidth,imgHeight){
LeftPosition = (screen.width) ? (screen.width-imgWidth)/2 : 0;
TopPosition = (screen.height) ? (screen.height-imgHeight)/2 : 0;
theName = name;
settings ='height='+imgHeight+',width='+imgWidth+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=no'
win = window.open(url,theName,settings)
if(win.window.focus){win.window.focus();}
}

// Pulldown menu
function TANK_jump(target) {
		var the_link = "photo_list.asp?folder=" + target;
		document.location.href = the_link;
}

// Only display scroll buttons if they are needed
function TANK_checkScroll() {
	if (document.all) {
		if(document.all.divContent.scrollHeight < document.all.divContainer.scrollHeight) {
			document.all.divUpControl.style.visibility = 'hidden';
			document.all.divDownControl.style.visibility = 'hidden';
		} else {
			document.all.divUpControl.style.visibility = 'visible';
			document.all.divDownControl.style.visibility = 'visible';
		}
	}
	if (document.layers) {
		if (window.document.divContainer.document.divContent.document.height < 280) {
			document.layers['divUpControl'].visibility = 'hidden';
			document.layers['divDownControl'].visibility = 'hidden';
		} else {
			document.layers['divUpControl'].visibility = 'show';
			document.layers['divDownControl'].visibility = 'show';
		}
	}
}


// ****************************************************
// ****************  Image Fade Effect ****************
// ****************************************************

var step = 20;
var delay = 100;
function fadeImageIn (img) {
	//delay += 100;
  if (document.all || navigator.appName == 'Netscape' && parseFloat
(navigator.appVersion) >= 5) {
    img.opacity = 0;
    setOpacity(img.name);
  }
}
function fadeImageOut (img, delay) {
  if (document.all || navigator.appName == 'Netscape' && parseFloat
(navigator.appVersion) >= 5) {
    img.opacity = 100;
    setOpacity(img.name, -step, delay);
  }
}
function setOpacity (imgName, step, delay) {
  if (!step)
    step = window.step;
  if (!delay)
    delay = window.delay;
  var img = document.images[imgName];
  img.opacity += step;
  if (document.all)
    img.style.filter = 'alpha(opacity = ' + img.opacity + ')';
  else if (navigator.appName == 'Netscape' &&
parseFloat(navigator.appVersion) >= 5)
    img.style.MozOpacity = img.opacity + '%';
  if (step > 0 && img.opacity < 100 || step < 0 && img.opacity > 0)
    setTimeout('setOpacity("' + img.name + '",' + step + ', ' + delay 
+ ')', delay);
}

// ****************************************************
// ******************  MM Functions *******************
// ****************************************************

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}


// begin absolutely positioned scrollable area object scripts 

function InitialiseScrollableArea(){ 
    objContainer=new ConstructObject('divContainer') 
    objScroller=new ConstructObject('divContent','divContainer') 
    objScroller.MoveArea(0,0) 
    objContainer.css.visibility='visible' 
    initialised=true; 
} 

function verifyCompatibleBrowser(){ 
    this.ver=navigator.appVersion 
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5) 
    return this 
}

bw=new verifyCompatibleBrowser();

var speed=50;
 
var loop, timer 
 
function ConstructObject(obj,nest){ 
    nest=(!nest) ? '':'document.'+nest+'.' 
    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
    this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight 
    this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight 
    this.up=MoveAreaUp;this.down=MoveAreaDown; 
    this.MoveArea=MoveArea; this.x; this.y; 
    this.obj = obj + "Object" 
    eval(this.obj + "=this") 
    return this 
} 
function MoveArea(x,y){ 
    this.x=x;this.y=y 
    this.css.left=this.x 
    this.css.top=this.y 
} 
 
function MoveAreaDown(move){ 
	if(this.y>-this.scrollHeight+objContainer.clipHeight){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".down("+move+")",speed) 
	} 
} 
function MoveAreaUp(move){ 
	if(this.y<0){ 
    this.MoveArea(0,this.y-move) 
    if(loop) setTimeout(this.obj+".up("+move+")",speed) 
	} 
} 
 
function PerformScroll(speed){ 
	if(initialised){ 
		loop=true; 
		if(speed>0) objScroller.down(speed) 
		else objScroller.up(speed) 
	} 
} 
 
function CeaseScroll(){ 
    loop=false 
    if(timer) clearTimeout(timer) 
} 
var initialised; 

// end absolutely positioned scrollable area object scripts 


// ***************************************************
// ****************** Form Functions *****************
// ***************************************************
//
// Confirm delete
function verify(){
    msg = "Are you sure that you want delete this entry?";
    return confirm(msg);
}

//Function to format text in the text box for IE
function FormatText(command, option, frameName){
  	eval('frames.' + frameName + '.document').execCommand(command, true, option);
  	eval('frames.' + frameName).focus();
}

//Function to add image
function AddImage(){	
	imagePath = prompt('Enter the web address of the image', 'http://');				
	
	if ((imagePath != null) && (imagePath != "")){					
		frames.PartyDetails.document.execCommand('InsertImage', false, imagePath);
  		frames.PartyDetails.focus();
	}
	frames.PartyDetails.focus();			
}

// Alert non-IE users if using the control panel
function nonIEAlert() {
	alert('You are not using IE 5+ /n Please access the Control Panel with IE 5+');
}
