File "jscript.js"

Full path: E:/sites/Single15/tinmung2007/webroot/GIADINHTANHIEN/CAC MIEN/HocMon/Tan Hien Bui Mon/album/res/jscript.js
File size: 8.84 KiB (9054 bytes)
MIME-type:
Charset: utf-8

Download   Open   Back

var displayids;
var currentpage = 1;
var pages;
var thumbs = new Array();



function ThumbsOnload() {
	height = GetHeight();
	document.getElementById("table").height = height-50;
	displayids = Math.round(2*(height - 120)/80);
	if (displayids % 2 != 0) {
		displayids ++;
	}
	thumbshtml = "";
	for(i=1;i<=displayids;i++) {
		if (i < thumbs.length) {
			thumbshtml += document.getElementById("body_id").innerHTML = '<div id="thumbdiv_' + i + '" class="thumbimg"> <a href="#" id="thumba_' + i + '"><img src="#" alt="#" id="thumbimg_' + i + '"/></a></div>';
		}
	}
	document.getElementById("body_id").innerHTML = thumbshtml;
	SetNav();
	Dothumbs();
}

function Dothumbs() {

	postop = 100;
	postopcenter = 100;
	lastthumb = currentpage*(displayids)+1;
	id = 0;
	for(i=((currentpage-1)*displayids+1);i<lastthumb;i++) {
		if (i < thumbs.length) {
			id++;
			if(thumbs[i][0] == 1) {
				onc="DoFadeOutAll('" + thumbs[i][1] + "')";
				document.getElementById("thumba_"+id).onclick = new Function(onc); 

				document.getElementById("thumba_"+id).href = "#";
				document.getElementById("thumba_"+id).target = "";

				document.getElementById("thumbimg_"+id).src = thumbs[i][3];
				document.getElementById("thumbimg_"+id).alt = thumbs[i][2];
				document.getElementById("thumbimg_"+id).width = thumbs[i][4];
				document.getElementById("thumbimg_"+id).height = thumbs[i][5];
				
				onmover = "describe('" + thumbs[i][2] +"')";
				document.getElementById("thumbimg_"+id).onmouseover = new Function(onmover); 
				onmout = "describe('')";
				document.getElementById("thumbimg_"+id).onmouseout = new Function(onmout); 
			}
			if(thumbs[i][0] == 2) {
				onc="";
				document.getElementById("thumba_"+id).onclick = new Function(onc); 

				document.getElementById("thumba_"+id).href = thumbs[i][1];
				document.getElementById("thumba_"+id).target = "_blank";

				document.getElementById("thumbimg_"+id).src = thumbs[i][3];
				document.getElementById("thumbimg_"+id).alt = thumbs[i][2];
				document.getElementById("thumbimg_"+id).width = thumbs[i][4];
				document.getElementById("thumbimg_"+id).height = thumbs[i][5];
				
				onmover = "describe('" + thumbs[i][2] +"')";
				document.getElementById("thumbimg_"+id).onmouseover = new Function(onmover); 
				onmout = "describe('')";
				document.getElementById("thumbimg_"+id).onmouseout = new Function(onmout); 
			}
			if(thumbs[i][0] == 3) {
				onc="DoFadeOut('" + thumbs[i][1] + "','slide')";
				document.getElementById("thumba_"+id).onclick = new Function(onc); 

				document.getElementById("thumba_"+id).href = "#";
				document.getElementById("thumba_"+id).target = "";

				document.getElementById("thumbimg_"+id).src = thumbs[i][3];
				document.getElementById("thumbimg_"+id).alt = thumbs[i][2];
				document.getElementById("thumbimg_"+id).width = thumbs[i][4];
				document.getElementById("thumbimg_"+id).height = thumbs[i][5];
				
				onmnone = "";
				document.getElementById("thumbimg_"+id).onmouseover = new Function(onmnone); 
				document.getElementById("thumbimg_"+id).onmouseout = new Function(onmnone); 
			}
			document.getElementById("thumbdiv_"+id).style.top = postopcenter-thumbs[i][5]/2+"px";
			document.getElementById("thumbdiv_"+id).style.display = "block";
			if (i % 2 == 0) {
				document.getElementById("thumbdiv_"+id).style.right = 100-thumbs[i][4]/2+"px";
				postop +=80;
				postopcenter +=80;
			} else {
				document.getElementById("thumbdiv_"+id).style.right = 180-thumbs[i][4]/2+"px";
			}
		}
	}
}

function Hidethumbs() {
	for(i=1;i<=displayids;i++) {
		if (i < thumbs.length) {
			document.getElementById("thumbdiv_"+i).style.display = "none";		
		}
	}
}

function SetNav() {
	pages = Math.ceil(thumbs.length/displayids);
	if (pages != 1) {
		document.getElementById("nav_pages").innerHTML = currentpage + "/" + pages;
	}
	if (currentpage == 1) {
		document.getElementById("nav_first").style.display = "none";
		document.getElementById("nav_prev").style.display = "none";
	} else {
		document.getElementById("nav_first").style.display = "block";
		document.getElementById("nav_prev").style.display = "block";
	}
	if (currentpage == pages) {
		document.getElementById("nav_next").style.display = "none";
		document.getElementById("nav_last").style.display = "none";
	} else {
		document.getElementById("nav_next").style.display = "block";
		document.getElementById("nav_last").style.display = "block";
	}	
	

}



function FirstThumbs() {
	currentpage = 1;
	SetFadeOpacity(0);
	document.getElementById("fade").style.display = "block";	
	CreateFadeOutthumb(0, 0);
}

function PrevThumbs() {
	currentpage -= 1;
	SetFadeOpacity(0);
	document.getElementById("fade").style.display = "block";	
	CreateFadeOutthumb(0, (currentpage-1)*displayids);
}


function NextThumbs() {
	currentpage += 1;
	SetFadeOpacity(0);
	document.getElementById("fade").style.display = "block";	
	CreateFadeOutthumb(0, (currentpage-1)*displayids);
}

function LastThumbs() {
	currentpage = pages;
	SetFadeOpacity(0);
	document.getElementById("fade").style.display = "block";	
	CreateFadeOutthumb(0, (pages-1)*displayids);
}







function DoFadeOut(Url, Location) {
	parent.frames[Location].SetFadeOpacity(0);
	parent.frames[Location].document.getElementById("fade").style.display = "block";	
	CreateFadeOut(Url, Location, 0);
}

function CreateFadeOut(Url, Location, Opacity) {
	if (Opacity < 100) {
		parent.frames[Location].SetFadeOpacity(Opacity);
		Opacity += 10;
		window.setTimeout("CreateFadeOut('"+Url+"', '"+Location+"', "+Opacity+")", 20);
	}
	else {
		window.open(Url, Location);
	}
}




function StartFadeIn() {
	document.getElementById("fade").style.display = "block";	
	CreateFadeIn(100);
}

function CreateFadeIn(Opacity) {
	if (Opacity > 0) {
		SetFadeOpacity(Opacity);
		Opacity -= 5;
		window.setTimeout("CreateFadeIn("+Opacity+")", 20);
	} else { 
		document.getElementById("fade").style.display = "none";	
	}
}





function CreateFadeOutthumb(Opacity, nextstartthumb) {
	if (Opacity < 100) {
		SetFadeOpacity(Opacity);
		Opacity += 10;
		window.setTimeout("CreateFadeOutthumb("+Opacity+","+nextstartthumb+")", 20);
	} else { 
		Hidethumbs();	
		Dothumbs();
		SetNav();
		CreateFadeIn(100);	
	}
}

function DoFadeOutAll(Url) {
	parent.frames['slide'].SetFadeOpacity(0);
	parent.frames['slide'].document.getElementById("fade").style.display = "block";	
	parent.frames['title'].SetFadeOpacity(0);
	parent.frames['title'].document.getElementById("fade").style.display = "block";	
	parent.frames['index'].SetFadeOpacity(0);
	parent.frames['index'].document.getElementById("fade").style.display = "block";	
	CreateFadeOutAll(Url, 0);
}


function CreateFadeOutAll(Url, Opacity) {
	if (Opacity < 100) {
		parent.frames['slide'].SetFadeOpacity(Opacity);
		parent.frames['title'].SetFadeOpacity(Opacity);
		parent.frames['index'].SetFadeOpacity(Opacity);
		Opacity += 10;
		window.setTimeout("CreateFadeOutAll('"+Url+"', "+Opacity+")", 20);
	} else {
		window.open(Url, "_top");
	}
}




function SetFadeOpacity(Opacity) {

	browserVer=parseInt(navigator.appVersion);
	browserName=navigator.appName;
	if (browserName == "Microsoft Internet Explorer"){
		document.getElementById("fade").style.filter = 'alpha(opacity='+Opacity+')';
	} else {
		document.getElementById("fade").style.opacity = Opacity/100;
	}
}



function GetHeight() {
	if( ( typeof( window.innerHeight ) == 'number' ) && (window.innerHeight > 0 ) ) {
		//Non-IE
		height = window.innerHeight;
	} else if( (document.documentElement) && (document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		height = document.documentElement.clientHeight;
	} else if( (document.body) && (document.body.clientHeight ) ) {
		//IE 4 compatible
		height = document.body.clientHeight;
	}
	return height;
}

function GetWidth() {
	if( ( typeof( window.innerWidth ) == 'number' ) && (window.innerWidth > 0 ) ) {
		//Non-IE
		width = window.innerWidth;
	} else if( (document.documentElement) && (document.documentElement.clientWidth ) ) {
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
	} else if( (document.body) && (document.body.clientWidth ) ) {
		//IE 4 compatible
		width = document.body.clientWidth;
	}
	return width;
}



function DoImageSize(h, b) {
	maxheight = GetHeight() - 80;
	if (maxheight < 100) {
		maxheight = 100;
	}
	maxwidth = GetWidth()*0.8;
	if (maxwidth < 100) {
		maxwidth = 100;
	}
	if (h > b) {
		if (h > maxheight) {
			hprop = h/maxheight;
			if (hprop > 1) {
				h = h/hprop;
				b = b/hprop;
			}
		}
	} else {
		if (b > maxwidth) {
			bprop = b/maxwidth;
			if (bprop > 1) {
				h = h/bprop;
				b = b/bprop;
			}
		}
	}
	document.getElementById("slide").height=h;
	document.getElementById("slide").width=b;
}

PHP File Manager