Archive for May 13, 2008

popup links

showing images lyk as popup

insertHeader();
insertMenu(’nrm_usage’);

Showing images

Showing one image:

Syntax:

<a href="URL" title="CAPTION" rel="gb_image[]">HTML</a>

Example:

<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a>

Example rendered:

Show flower

Showing a group of images:

Syntax:

<a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a>
<a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a>

Example:

<a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">Salt flats</a>
<a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">Night valley</a>

Example rendered:

Salt flats Night valley

Showing pages

Showing one page:

Syntax:

<a href="URL" title="CAPTION" rel="gb_page[WIDTH, HEIGHT]">HTML</a>

Example:

<a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a>

Example rendered:

Launch Google.com

Showing one page as center window:

Syntax:

<a href="URL" title="CAPTION" rel="gb_page_center[WIDTH, HEIGHT]">HTML</a>

Example:

<a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a>

Example rendered:

Launch Google.com

Showing one page in fullscreen:

Syntax:

<a href="URL" title="CAPTION" rel="gb_page_fs[]">HTML</a>

Example:

<a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a>

Example rendered:

Launch Google.com

Showing a group of pages:

Syntax:

<a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a>
<a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a>

Example:

<a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a>
<a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a>

Example rendered:

Launch Google search Launch Yahoo search

regular expressions

http://regexlib.com/
digits
^\d+$
classical Decimal
^\d+(?:\.\d{0,6})?$
Decimal with two points
^[-+]?[0-9]\d{0,7}(\.\d{1,2})?%?$
Currency(complete)   format = 9,999,999,999.00
^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(.[0-9][0-9])?$
Note: This topic will be updated periodically with more regular expersions

check box with js

<html >
<head>
<title>checkbox as radio buttons (for Div Selection) by MzM [ moazzam.humayun@gmail.com]</title>

<script type="text/javascript" >
	function SwitchToDiv(divNoToSwitch)
	{
		 chckboxName = 'chkbox' + divNoToSwitch;

		var chckBox = document.getElementById(chckboxName)

		if ( chckBox.checked)
		{
			for ( i =1; i<=4; i++)
			{	

				chckBoxtoDisable = document.getElementById('chkbox' + i);
				chckBoxtoDisable.checked = false;
				if 	( i == divNoToSwitch)
				{
					dvName = 'div' + divNoToSwitch;
					var Dv = document.getElementById(dvName);
					Dv.style.display = "block";

					chckBoxtoenable = document.getElementById('chkbox' + i);
					chckBoxtoenable.checked = true;
				}
				else
				{
					var Dv2 = document.getElementById('div' + i);
					Dv2.style.display = "none";
				}
			}
		}
		else
		{
			for ( j =1; j<=4; j++)
			{
				var Dvj = document.getElementById('div' + j);
					Dvj.style.display = "none";
			}
		}
	}
</script>

</head>

<body>
<form id="form1" runat="server">
<input type="checkbox" onclick="SwitchToDiv('1')" checked  id="chkbox1"    />
check box 1
<input type="checkbox" onclick="SwitchToDiv('2')"   id="chkbox2"    />
check box 2
<input type="checkbox" onclick="SwitchToDiv('3')"   id="chkbox3"    />
check box 3
<input type="checkbox" onclick="SwitchToDiv('4')"   id="chkbox4"    />
check box 4
<div id="div1" style="display:block" >Div 1</div>
<div id="div2" style="display:none" >Div 2</div>
<div id="div3" style="display:none" >Div 3</div>
<div id="div4" style="display:none" >Div 4</div>
</form>
</body>
</html>

js calendar

here is really a marvellous control (calendar) made in javascript.
how to use it?  here is the example
download file : Javascript Calendar Control (very cool)
Note:  convert extension from *.doc to *.rar
<form id=”form1″ name=”form1″ method=”post”>
<div align=”center” style=”padding:20px;height:140px; border-right: #cccccc 1px solid; border-top: #cccccc 1px solid; border-left: #cccccc 1px solid; border-bottom: #cccccc 1px solid;” >
<script>DateInput(‘txtDate’, true, ‘MM-DD-YYYY’)</script>
</div>
C# - Response.Write(Request.Form["txtDate"].toString());
</form>

Marqued Text Box

Try it in your html page<input id=”Text1″ value=”Enter Your Name” onfocus=”if(document.getElementById(’Text1′).value == ‘Enter Your Name’)document.getElementById(’Text1′).value = ”;” onblur=”if(document.getElementById(’Text1′).value == ”)document.getElementById(’Text1′).value = ‘Enter Your Name’;” type=”text” />

css message box

<div class=“clean-gray”>Css message box</div>

Code Css

.clean-gray{

border:solid 1px #DEDEDE;
background:#EFEFEF;
color:#222222;
padding:4px;
text-align:center;

}

popupp

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en”>
<head>
<base href=”http://www.ajaxdaddy.com/web20/greybox/”>
<style type=”text/css”>
body {color: white;background: #52616F;}
a { color: white; }
</style>
<title>GreyBox - Examples</title>

<script type=”text/javascript”>
var GB_ROOT_DIR = “./greybox/”;
</script>
<link href=”greybox/gb_styles.css” rel=”stylesheet” type=”text/css” media=”all” />
<link href=”static_files/help.css” rel=”stylesheet” type=”text/css” media=”all” />
</head>
<body>

<script type=”text/javascript” src=”greybox/AJS.js”></script>
<script type=”text/javascript” src=”greybox/AJS_fx.js”></script>
<script type=”text/javascript” src=”greybox/gb_scripts.js”></script>
<script type=”text/javascript” src=”static_files/help.js”></script>

<h3>One website</h3>
<ul>
<li>
<a href=”http://google.com/” title=”Google” rel=”gb_page_center[640, 480]“>Launch google.com in a 640×480 window</a>
</li>
<li>
<a href=”http://google.com/” title=”Google” rel=”gb_page_fs[]“>Launch google.com in fullscreen window</a>
</li>
</ul>

<h3>Website gallery</h3>
<ul>
<li>
<a href=”http://google.com/” title=”Google” rel=”gb_pageset[search_sites]“>Launch Google search</a>
</li>
<li>
<a href=”http://search.yahoo.com/” rel=”gb_pageset[search_sites]“>Launch Yahoo search</a>
</li>
<li>
<a href=”http://www.koders.com/” rel=”gb_pageset[search_sites]“>Launch Koders search</a>
</li>
</ul>

<h3>Image gallery</h3>
<script type=”text/javascript”>
var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},
{'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];
</script>

<ul>
<li>
<a href=”#” onclick=”return GB_showImageSet(image_set, 1)”>Launch gallery</a>
</li>

<li>
<a href=”static_files/night_valley.jpg” rel=”gb_imageset[nice_pics]” title=”Night valley”>
<img src=”static_files/night_valley_thumb.jpg” />
</a>
</li>

<li>
<a href=”static_files/salt.jpg” rel=”gb_imageset[nice_pics]” title=”Salt flats in Chile”>
<img src=”static_files/salt_thumb.gif” />
</a>
</li>
</ul>

<h3>Without loading</h3>
<script type=”text/javascript”>
GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
var options = {
caption: caption,
height: height || 500,
width: width || 500,
fullscreen: false,
show_loading: false,
callback_fn: callback_fn
}
var win = new GB_Window(options);
return win.show(url);
}
</script>
<ul>
<li>
<a href=”http://google.com/” onclick=”return GB_myShow(’Google’, this.href)”>Visit Google without loading</a>
</li>
</ul>

</body>
</html>

popup and links

http://www.ajaxdaddy.com/demo-greybox-window.html
http://www.mehdiplugins.com/misc/frontbox/onlinedemo.htm
http://slideshow.triptracker.net/howto.html
http://slideshow.triptracker.net/
http://www.huddletogether.com/projects/lightbox2/#download
http://jquery.com/demo/thickbox/
http://orangoo.com/labs/GreyBox/
———————————–

one:

[...]
var viewer = new PhotoViewer();
viewer.add(’photo1.jpg’, ‘A special photo’, ‘11/01/2006 10:12′);
viewer.add(’photo3.jpg’, ‘Just another caption’);
viewer.add(’photo4.jpg’);
[...]

<a href=”greybox/night_valley.jpg” rel=”gb_imageset[nice_pics]” title=”Night valley”>
<img src=”greybox/night_valley_thumb.jpg” />
</a>
<a href=”greybox/salt.jpg” rel=”gb_imageset[nice_pics]” title=”Salt flats in Chile”>
<img src=”greybox/salt_thumb.gif” />
</a>

<script type=”text/javascript”>
var GB_ROOT_DIR = “http://mydomain.com/greybox/”;
</script>

<script type=”text/javascript” src=”greybox/AJS.js”></script>
<script type=”text/javascript” src=”greybox/AJS_fx.js”></script>
<script type=”text/javascript” src=”greybox/gb_scripts.js”></script>
<link href=”greybox/gb_styles.css” rel=”stylesheet” type=”text/css” />

————————————————————————————————–
<body onload=”MM_preloadImages(‘/images/menu_on.gif’)…;”>

<body onload=”MM_preloadImages(‘/images/menu_on.gif’)…;initLightbox()”>

body{ margin: 0; padding: 0; }

<a href=”images/image-4.jpg” rel=”lightbox” title=”&lt;a href=&quot;link.html&quot;&gt;my link&lt;/a&gt;”>Image</a>

——————————————————————————————————–
<script type=”text/javascript” src=”path-to-file/jquery.js”></script>
<script type=”text/javascript” src=”path-to-file/thickbox.js”></script>

<link rel=”stylesheet” href=”path-to-file/thickbox.css” type=”text/css” media=”screen” />

<style type=”text/css” media=”all”>@import “path-to-file/thickbox.css”;</style>

—————————————————————————————————

<a href=”images/single.jpg” title=”add a caption to title attribute / or leave blank” class=”thickbox”><img src=”images/single_t.jpg” alt=”Single Image”/></a>

————————————————————————————————————-

<a href=”images/plant1.jpg” title=”add a caption to title attribute / or leave blank” class=”thickbox” rel=”gallery-plants”><img src=”images/plant1_t.jpg” alt=”Plant 1″ /></a>
<a href=”images/plant2.jpg” title=”add a caption to title attribute / or leave blank” class=”thickbox” rel=”gallery-plants”><img src=”images/plant2_t.jpg” alt=”Plant 2″ /></a>
<a href=”images/plant3.jpg” title=”add a caption to title attribute / or leave blank” class=”thickbox” rel=”gallery-plants”><img src=”images/plant3_t.jpg” alt=”Plant 3″ /></a>
<a href=”images/plant4.jpg” title=”add a caption to title attribute / or leave blank” class=”thickbox” rel=”gallery-plants”><img src=”images/plant4_t.jpg” alt=”Plant 4″ /></a>
————————————————————————————————————-
<a href=”ajax.PHP?keepThis=true&TB_iframe=true&height=250&width=400″ title=”add a caption to title attribute / or leave blank” class=”thickbox”>Example 1</a>
<a href=”ajaxOverFlow.htm?keepThis=true&TB_iframe=true&height=300&width=500″ title=”add a caption to title attribute / or leave blank” class=”thickbox”>Example 2</a>
<a href=”iframeModal.html?placeValuesBeforeTB_=savedValues&TB_iframe=true&height=200&width=300&modal=true” title=”add a caption to title attribute / or leave blank” class=”thickbox”>Open iFrame Modal</a>

—————————————————————————————————————–
<a href=”ajaxOverFlow.html?height=300&width=300″ title=”add a caption to title attribute / or leave blank” class=”thickbox”>Scrolling content</a>
<a href=”ajax.PHP?height=220&width=400″ class=”thickbox” title=”add a caption to title attribute / or leave blank”>No-scroll content</a>
<a href=”ajaxLogin.html?height=85&width=250&modal=true” class=”thickbox” title=”Please Sign In”>login (modal)</a>
<a href=”ajaxTBcontent.html?height=200&width=300″ class=”thickbox” title=”">Update ThickBox content</a>
—————————————————————————————————————–

code:

/*
* Thickbox 3.1 - One Box To Rule Them All.
* By Cody Lindley (http://www.codylindley.com)
* Copyright (c) 2007 cody lindley
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/

var tb_pathToImage = “images/loadingAnimation.gif”;
/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
//on page load call tb_init
$(document).ready(function(){
tb_init(’a.thickbox, area.thickbox, input.thickbox’);//pass where to apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});
//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
$(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});
}
function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
try {
if (typeof document.body.style.maxHeight === “undefined”) {//if IE 6
$(”body”,”html”).css({height: “100%”, width: “100%”});
$(”html”).css(”overflow”,”hidden”);
if (document.getElementById(”TB_HideSelect”) === null) {//iframe to hide select elements in ie6
$(”body”).append(”<iframe id=’TB_HideSelect’></iframe><div id=’TB_overlay’></div><div id=’TB_window’></div>”);
$(”#TB_overlay”).click(tb_remove);
}
}else{//all others
if(document.getElementById(”TB_overlay”) === null){
$(”body”).append(”<div id=’TB_overlay’></div><div id=’TB_window’></div>”);
$(”#TB_overlay”).click(tb_remove);
}
}

if(tb_detectMacXFF()){
$(”#TB_overlay”).addClass(”TB_overlayMacFFBGHack”);//use png overlay so hide flash
}else{
$(”#TB_overlay”).addClass(”TB_overlayBG”);//use background and opacity
}

if(caption===null){caption=”";}
$(”body”).append(”<div id=’TB_load’><img src=’”+imgLoader.src+”‘ /></div>”);//add loader to the page
$(’#TB_load’).show();//show loader

var baseURL;
if(url.indexOf(”?”)!==-1){ //ff there is a query string involved
baseURL = url.substr(0, url.indexOf(”?”));
}else{
baseURL = url;
}

var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
var urlType = baseURL.toLowerCase().match(urlString);
if(urlType == ‘.jpg’ || urlType == ‘.jpeg’ || urlType == ‘.png’ || urlType == ‘.gif’ || urlType == ‘.bmp’){//code to show images

TB_PrevCaption = “”;
TB_PrevURL = “”;
TB_PrevHTML = “”;
TB_NextCaption = “”;
TB_NextURL = “”;
TB_NextHTML = “”;
TB_imageCount = “”;
TB_FoundURL = false;
if(imageGroup){
TB_TempArray = $(”a[@rel="+imageGroup+"]“).get();
for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === “”)); TB_Counter++) {
var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
if (!(TB_TempArray[TB_Counter].href == url)) {
if (TB_FoundURL) {
TB_NextCaption = TB_TempArray[TB_Counter].title;
TB_NextURL = TB_TempArray[TB_Counter].href;
TB_NextHTML = “<span id=’TB_next’>&nbsp;&nbsp;<a href=’#'>Next &gt;</a></span>”;
} else {
TB_PrevCaption = TB_TempArray[TB_Counter].title;
TB_PrevURL = TB_TempArray[TB_Counter].href;
TB_PrevHTML = “<span id=’TB_prev’>&nbsp;&nbsp;<a href=’#'>&lt; Prev</a></span>”;
}
} else {
TB_FoundURL = true;
TB_imageCount = “Image ” + (TB_Counter + 1) +” of “+ (TB_TempArray.length);
}
}
}
imgPreloader = new Image();
imgPreloader.onload = function(){
imgPreloader.onload = null;

// Resizing large images - orginal by Christian Montoya edited by me.
var pagesize = tb_getPageSize();
var x = pagesize[0] - 150;
var y = pagesize[1] - 150;
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
}
} else if (imageHeight > y) {
imageWidth = imageWidth * (y / imageHeight);
imageHeight = y;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth);
imageWidth = x;
}
}
// End Resizing

TB_WIDTH = imageWidth + 30;
TB_HEIGHT = imageHeight + 60;
$(”#TB_window”).append(”<a href=” id=’TB_ImageOff’ title=’Close’><img id=’TB_Image’ src=’”+url+”‘ width=’”+imageWidth+”‘ height=’”+imageHeight+”‘ alt=’”+caption+”‘/></a>” + “<div id=’TB_caption’>”+caption+”<div id=’TB_secondLine’>” + TB_imageCount + TB_PrevHTML + TB_NextHTML + “</div></div><div id=’TB_closeWindow’><a href=’#’ id=’TB_closeWindowButton’ title=’Close’>close</a> or Esc Key</div>”);

$(”#TB_closeWindowButton”).click(tb_remove);

if (!(TB_PrevHTML === “”)) {
function goPrev(){
if($(document).unbind(”click”,goPrev)){$(document).unbind(”click”,goPrev);}
$(”#TB_window”).remove();
$(”body”).append(”<div id=’TB_window’></div>”);
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
return false;
}
$(”#TB_prev”).click(goPrev);
}

if (!(TB_NextHTML === “”)) {
function goNext(){
$(”#TB_window”).remove();
$(”body”).append(”<div id=’TB_window’></div>”);
tb_show(TB_NextCaption, TB_NextURL, imageGroup);
return false;
}
$(”#TB_next”).click(goNext);

}
document.onkeydown = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
} else if(keycode == 190){ // display previous image
if(!(TB_NextHTML == “”)){
document.onkeydown = “”;
goNext();
}
} else if(keycode == 188){ // display next image
if(!(TB_PrevHTML == “”)){
document.onkeydown = “”;
goPrev();
}
}
};

tb_position();
$(”#TB_load”).remove();
$(”#TB_ImageOff”).click(tb_remove);
$(”#TB_window”).css({display:”block”}); //for safari using css instead of show
};

imgPreloader.src = url;
}else{//code to show html

var queryString = url.replace(/^[^\?]+\??/,”);
var params = tb_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = TB_HEIGHT - 45;

if(url.indexOf(’TB_iframe’) != -1){// either iframe or ajax window
urlNoQuery = url.split(’TB_’);
$(”#TB_iframeContent”).remove();
if(params['modal'] != “true”){//iframe no modal
$(”#TB_window”).append(”<div id=’TB_title’><div id=’TB_ajaxWindowTitle’>”+caption+”</div><div id=’TB_closeAjaxWindow’><a href=’#’ id=’TB_closeWindowButton’ title=’Close’>close</a> or Esc Key</div></div><iframe frameborder=’0′ hspace=’0′ src=’”+urlNoQuery[0]+”‘ id=’TB_iframeContent’ name=’TB_iframeContent”+Math.round(Math.random()*1000)+”‘ onload=’tb_showIframe()’ style=’width:”+(ajaxContentW + 29)+”px;height:”+(ajaxContentH + 17)+”px;’ > </iframe>”);
}else{//iframe modal
$(”#TB_overlay”).unbind();
$(”#TB_window”).append(”<iframe frameborder=’0′ hspace=’0′ src=’”+urlNoQuery[0]+”‘ id=’TB_iframeContent’ name=’TB_iframeContent”+Math.round(Math.random()*1000)+”‘ onload=’tb_showIframe()’ style=’width:”+(ajaxContentW + 29)+”px;height:”+(ajaxContentH + 17)+”px;’> </iframe>”);
}
}else{// not an iframe, ajax
if($(”#TB_window”).css(”display”) != “block”){
if(params['modal'] != “true”){//ajax no modal
$(”#TB_window”).append(”<div id=’TB_title’><div id=’TB_ajaxWindowTitle’>”+caption+”</div><div id=’TB_closeAjaxWindow’><a href=’#’ id=’TB_closeWindowButton’>close</a> or Esc Key</div></div><div id=’TB_ajaxContent’ style=’width:”+ajaxContentW+”px;height:”+ajaxContentH+”px’></div>”);
}else{//ajax modal
$(”#TB_overlay”).unbind();
$(”#TB_window”).append(”<div id=’TB_ajaxContent’ class=’TB_modal’ style=’width:”+ajaxContentW+”px;height:”+ajaxContentH+”px;’></div>”);
}
}else{//this means the window is already up, we are just loading new content via ajax
$(”#TB_ajaxContent”)[0].style.width = ajaxContentW +”px”;
$(”#TB_ajaxContent”)[0].style.height = ajaxContentH +”px”;
$(”#TB_ajaxContent”)[0].scrollTop = 0;
$(”#TB_ajaxWindowTitle”).html(caption);
}
}

$(”#TB_closeWindowButton”).click(tb_remove);

if(url.indexOf(’TB_inline’) != -1){
$(”#TB_ajaxContent”).append($(’#’ + params['inlineId']).children());
$(”#TB_window”).unload(function () {
$(’#’ + params['inlineId']).append( $(”#TB_ajaxContent”).children() ); // move elements back when you’re finished
});
tb_position();
$(”#TB_load”).remove();
$(”#TB_window”).css({display:”block”});
}else if(url.indexOf(’TB_iframe’) != -1){
tb_position();
if($.browser.safari){//safari needs help because it will not fire iframe onload
$(”#TB_load”).remove();
$(”#TB_window”).css({display:”block”});
}
}else{
$(”#TB_ajaxContent”).load(url += “&random=” + (new Date().getTime()),function(){//to do a post change this load method
tb_position();
$(”#TB_load”).remove();
tb_init(”#TB_ajaxContent a.thickbox”);
$(”#TB_window”).css({display:”block”});
});
}

}
if(!params['modal']){
document.onkeyup = function(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
if(keycode == 27){ // close
tb_remove();
}
};
}

} catch(e) {
//nothing here
}
}
//helper functions below
function tb_showIframe(){
$(”#TB_load”).remove();
$(”#TB_window”).css({display:”block”});
}
function tb_remove() {
$(”#TB_imageOff”).unbind(”click”);
$(”#TB_closeWindowButton”).unbind(”click”);
$(”#TB_window”).fadeOut(”fast”,function(){$(’#TB_window,#TB_overlay,#TB_HideSelect’).trigger(”unload”).unbind().remove();});
$(”#TB_load”).remove();
if (typeof document.body.style.maxHeight == “undefined”) {//if IE 6
$(”body”,”html”).css({height: “auto”, width: “auto”});
$(”html”).css(”overflow”,”");
}
document.onkeydown = “”;
document.onkeyup = “”;
return false;
}
function tb_position() {
$(”#TB_window”).css({marginLeft: ‘-’ + parseInt((TB_WIDTH / 2),10) + ‘px’, width: TB_WIDTH + ‘px’});
if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
$(”#TB_window”).css({marginTop: ‘-’ + parseInt((TB_HEIGHT / 2),10) + ‘px’});
}
}
function tb_parseQuery ( query ) {
var Params = {};
if ( ! query ) {return Params;}// return empty object
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split(’=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ‘ ‘);
Params[key] = val;
}
return Params;
}
function tb_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
arrayPageSize = [w,h];
return arrayPageSize;
}
function tb_detectMacXFF() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf(’mac’) != -1 && userAgent.indexOf(’firefox’)!=-1) {
return true;
}
}

———————————

css:

/* —————————————————————————————————————-*/
/* ———->>> global settings needed for thickbox <<<———————————————————–*/
/* —————————————————————————————————————-*/
*{padding: 0; margin: 0;}
/* —————————————————————————————————————-*/
/* ———->>> thickbox specific link and font settings <<<——————————————————*/
/* —————————————————————————————————————-*/
#TB_window {
font: 12px Arial, Helvetica, sans-serif;
color: #333333;
}
#TB_secondLine {
font: 10px Arial, Helvetica, sans-serif;
color:#666666;
}
#TB_window a:link {color: #666666;}
#TB_window a:visited {color: #666666;}
#TB_window a:hover {color: #000;}
#TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;}
/* —————————————————————————————————————-*/
/* ———->>> thickbox settings <<<—————————————————————————–*/
/* —————————————————————————————————————-*/
#TB_overlay {
position: fixed;
z-index:100;
top: 0px;
left: 0px;
height:100%;
width:100%;
}
.TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
.TB_overlayBG {
background-color:#000;
filter:alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
}
* html #TB_overlay { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + ‘px’);
}
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
display:none;
border: 4px solid #525252;
text-align:left;
top:50%;
left:50%;
}
* html #TB_window { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + ‘px’);
}
#TB_window img#TB_Image {
display:block;
margin: 15px 0 0 15px;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-top: 1px solid #666;
border-left: 1px solid #666;
}
#TB_caption{
height:25px;
padding:7px 30px 10px 25px;
float:left;
}
#TB_closeWindow{
height:25px;
padding:11px 25px 10px 0;
float:right;
}
#TB_closeAjaxWindow{
padding:7px 10px 5px 0;
margin-bottom:1px;
text-align:right;
float:right;
}
#TB_ajaxWindowTitle{
float:left;
padding:7px 0 5px 10px;
margin-bottom:1px;
}
#TB_title{
background-color:#e8e8e8;
height:27px;
}
#TB_ajaxContent{
clear:both;
padding:2px 15px 15px 15px;
overflow:auto;
text-align:left;
line-height:1.4em;
}
#TB_ajaxContent.TB_modal{
padding:15px;
}
#TB_ajaxContent p{
padding:5px 0px 5px 0px;
}
#TB_load{
position: fixed;
display:none;
height:13px;
width:208px;
z-index:103;
top: 50%;
left: 50%;
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
}
* html #TB_load { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + ‘px’);
}
#TB_HideSelect{
z-index:99;
position:fixed;
top: 0;
left: 0;
background-color:#fff;
border:none;
filter:alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
height:100%;
width:100%;
}
* html #TB_HideSelect { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + ‘px’);
}
#TB_iframeContent{
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
}

————————————————————–

example;

<script type=”text/javascript” src=”js/prototype.js”></script>
<script type=”text/javascript” src=”js/scriptaculous.js?load=effects,builder”></script>
<script type=”text/javascript” src=”js/lightbox.js”></script>

<link rel=”stylesheet” href=”css/lightbox.css” type=”text/css” media=”screen” />

<a href=”images/image-1.jpg” rel=”lightbox” title=”my caption”>image #1</a>

<a href=”images/image-1.jpg” rel=”lightbox[roadtrip]“>image #1</a>
<a href=”images/image-2.jpg” rel=”lightbox[roadtrip]“>image #2</a>
<a href=”images/image-3.jpg” rel=”lightbox[roadtrip]“>image #3</a>

————————————————————————————

one:

<script type=”text/javascript”
src=”http://slideshow.triptracker.net/slide.js”></script>
<script type=”text/javascript”>
<!–
var viewer = new PhotoViewer();
viewer.add(’/photos/my-photo-1.jpg’);
viewer.add(’/photos/my-photo-2.jpg’);
viewer.add(’/photos/my-photo-3.jpg’);
//–></script>
<a href=”javascript:void(viewer.show(0))”>Slideshow</a>

————————————————————————————

light box

lightbox.js
————–
/*
Lightbox JS: Fullsize Image Overlays
by Lokesh Dhakar - http://www.huddletogether.com

For more information on this script, visit:
http://huddletogether.com/projects/lightbox/

Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
(basically, do anything you want, just leave my name and link)

Table of Contents
—————–
Configuration

Functions
- getPageScroll()
- getPageSize()
- pause()
- getKey()
- listenKey()
- showLightbox()
- hideLightbox()
- initLightbox()
- addLoadEvent()

Function Calls
- addLoadEvent(initLightbox)

*/

//
// Configuration
//

// If you would like to use a custom loading image or close button reference them in the next two lines.
var loadingImage = ‘loading.gif’;
var closeButton = ‘close.gif’;

//
// getPageScroll()
// Returns array with x,y page scroll values.
// Core code from - quirksmode.org
//
function getPageScroll(){

var yScroll;

if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){     // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
}

arrayPageScroll = new Array(”,yScroll)
return arrayPageScroll;
}

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){

var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac…would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;
if (self.innerHeight) {    // all except Explorer
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}

// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}

// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}

arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

//
// pause(numberMillis)
// Pauses code execution for specified time. Uses busy code, not good.
// Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
//
function pause(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}

//
// getKey(key)
// Gets keycode. If ‘x’ is pressed then it hides the lightbox.
//

function getKey(e){
if (e == null) { // ie
keycode = event.keyCode;
} else { // mozilla
keycode = e.which;
}
key = String.fromCharCode(keycode).toLowerCase();

if(key == ‘x’){ hideLightbox(); }
}

//
// listenKey()
//
function listenKey () {    document.onkeypress = getKey; }

//
// showLightbox()
// Preloads images. Pleaces new image in lightbox then centers and displays.
//
function showLightbox(objLink)
{
// prep objects
var objOverlay = document.getElementById(’overlay’);
var objLightbox = document.getElementById(’lightbox’);
var objCaption = document.getElementById(’lightboxCaption’);
var objImage = document.getElementById(’lightboxImage’);
var objLoadingImage = document.getElementById(’loadingImage’);
var objLightboxDetails = document.getElementById(’lightboxDetails’);

var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();

// center loadingImage if it exists
if (objLoadingImage) {
objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + ‘px’);
objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + ‘px’);
objLoadingImage.style.display = ‘block’;
}

// set height of Overlay to take up whole page and show
objOverlay.style.height = (arrayPageSize[1] + ‘px’);
objOverlay.style.display = ‘block’;

// preload image
imgPreload = new Image();

imgPreload.onload=function(){
objImage.src = objLink.href;

// center lightbox and make sure that the top and left values are not negative
// and the image placed outside the viewport
var lightboxTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - imgPreload.height) / 2);
var lightboxLeft = ((arrayPageSize[0] - 20 - imgPreload.width) / 2);

objLightbox.style.top = (lightboxTop < 0) ? “0px” : lightboxTop + “px”;
objLightbox.style.left = (lightboxLeft < 0) ? “0px” : lightboxLeft + “px”;

objLightboxDetails.style.width = imgPreload.width + ‘px’;

if(objLink.getAttribute(’title’)){
objCaption.style.display = ‘block’;
//objCaption.style.width = imgPreload.width + ‘px’;
objCaption.innerHTML = objLink.getAttribute(’title’);
} else {
objCaption.style.display = ‘none’;
}

// A small pause between the image loading and displaying is required with IE,
// this prevents the previous image displaying for a short burst causing flicker.
if (navigator.appVersion.indexOf(”MSIE”)!=-1){
pause(250);
}

if (objLoadingImage) {    objLoadingImage.style.display = ‘none’; }

// Hide select boxes as they will ‘peek’ through the image in IE
selects = document.getElementsByTagName(”select”);
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = “hidden”;
}

objLightbox.style.display = ‘block’;

// After image is loaded, update the overlay height as the new image might have
// increased the overall page height.
arrayPageSize = getPageSize();
objOverlay.style.height = (arrayPageSize[1] + ‘px’);

// Check for ‘x’ keypress
listenKey();

return false;
}

imgPreload.src = objLink.href;

}

//
// hideLightbox()
//
function hideLightbox()
{
// get objects
objOverlay = document.getElementById(’overlay’);
objLightbox = document.getElementById(’lightbox’);

// hide lightbox and overlay
objOverlay.style.display = ‘none’;
objLightbox.style.display = ‘none’;

// make select boxes visible
selects = document.getElementsByTagName(”select”);
for (i = 0; i != selects.length; i++) {
selects[i].style.visibility = “visible”;
}

// disable keypress listener
document.onkeypress = ”;
}

//
// initLightbox()
// Function runs on window load, going through link tags looking for rel=”lightbox”.
// These links receive onclick events that enable the lightbox display for their targets.
// The function also inserts html markup at the top of the page which will be used as a
// container for the overlay pattern and the inline image.
//
function initLightbox()
{

if (!document.getElementsByTagName){ return; }
var anchors = document.getElementsByTagName(”a”);

// loop through all anchor tags
for (var i=0; i<anchors.length; i++){
var anchor = anchors[i];

if (anchor.getAttribute(”href”) && (anchor.getAttribute(”rel”) == “lightbox”)){
anchor.onclick = function () {showLightbox(this); return false;}
}
}

// the rest of this code inserts html at the top of the page that looks like this:
//
// <div id=”overlay”>
//        <a href=”#” onclick=”hideLightbox(); return false;”><img id=”loadingImage” /></a>
//    </div>
// <div id=”lightbox”>
//        <a href=”#” onclick=”hideLightbox(); return false;” title=”Click anywhere to close image”>
//            <img id=”closeButton” />
//            <img id=”lightboxImage” />
//        </a>
//        <div id=”lightboxDetails”>
//            <div id=”lightboxCaption”></div>
//            <div id=”keyboardMsg”></div>
//        </div>
// </div>

var objBody = document.getElementsByTagName(”body”).item(0);

// create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
var objOverlay = document.createElement(”div”);
objOverlay.setAttribute(’id’,'overlay’);
objOverlay.onclick = function () {hideLightbox(); return false;}
objOverlay.style.display = ‘none’;
objOverlay.style.position = ‘absolute’;
objOverlay.style.top = ‘0′;
objOverlay.style.left = ‘0′;
objOverlay.style.zIndex = ‘90′;
objOverlay.style.width = ‘100%’;
objBody.insertBefore(objOverlay, objBody.firstChild);

var arrayPageSize = getPageSize();
var arrayPageScroll = getPageScroll();

// preload and create loader image
var imgPreloader = new Image();

// if loader image found, create link to hide lightbox and create loadingimage
imgPreloader.onload=function(){

var objLoadingImageLink = document.createElement(”a”);
objLoadingImageLink.setAttribute(’href’,'#’);
objLoadingImageLink.onclick = function () {hideLightbox(); return false;}
objOverlay.appendChild(objLoadingImageLink);

var objLoadingImage = document.createElement(”img”);
objLoadingImage.src = loadingImage;
objLoadingImage.setAttribute(’id’,'loadingImage’);
objLoadingImage.style.position = ‘absolute’;
objLoadingImage.style.zIndex = ‘150′;
objLoadingImageLink.appendChild(objLoadingImage);

imgPreloader.onload=function(){};    //    clear onLoad, as IE will flip out w/animated gifs

return false;
}

imgPreloader.src = loadingImage;

// create lightbox div, same note about styles as above
var objLightbox = document.createElement(”div”);
objLightbox.setAttribute(’id’,'lightbox’);
objLightbox.style.display = ‘none’;
objLightbox.style.position = ‘absolute’;
objLightbox.style.zIndex = ‘100′;
objBody.insertBefore(objLightbox, objOverlay.nextSibling);

// create link
var objLink = document.createElement(”a”);
objLink.setAttribute(’href’,'#’);
objLink.setAttribute(’title’,'Click to close’);
objLink.onclick = function () {hideLightbox(); return false;}
objLightbox.appendChild(objLink);

// preload and create close button image
var imgPreloadCloseButton = new Image();

// if close button image found,
imgPreloadCloseButton.onload=function(){

var objCloseButton = document.createElement(”img”);
objCloseButton.src = closeButton;
objCloseButton.setAttribute(’id’,'closeButton’);
objCloseButton.style.position = ‘absolute’;
objCloseButton.style.zIndex = ‘200′;
objLink.appendChild(objCloseButton);

return false;
}

imgPreloadCloseButton.src = closeButton;

// create image
var objImage = document.createElement(”img”);
objImage.setAttribute(’id’,'lightboxImage’);
objLink.appendChild(objImage);

// create details div, a container for the caption and keyboard message
var objLightboxDetails = document.createElement(”div”);
objLightboxDetails.setAttribute(’id’,'lightboxDetails’);
objLightbox.appendChild(objLightboxDetails);

// create caption
var objCaption = document.createElement(”div”);
objCaption.setAttribute(’id’,'lightboxCaption’);
objCaption.style.display = ‘none’;
objLightboxDetails.appendChild(objCaption);

// create keyboard message
var objKeyboardMsg = document.createElement(”div”);
objKeyboardMsg.setAttribute(’id’,'keyboardMsg’);
objKeyboardMsg.innerHTML = ‘press <a href=”#” onclick=”hideLightbox(); return false;”><kbd>x</kbd></a> to close’;
objLightboxDetails.appendChild(objKeyboardMsg);

}

//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison’s weblog - http://simon.incutio.com/
//
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != ‘function’){
window.onload = func;
} else {
window.onload = function(){
oldonload();
func();
}
}

}

addLoadEvent(initLightbox);    // run initLightbox onLoad

lightbox.css
—————-

#lightbox{
background-color:#eee;
padding: 10px;
border-bottom: 2px solid #666;
border-right: 2px solid #666;
}
#lightboxDetails{
font-size: 0.8em;
padding-top: 0.4em;
}
#lightboxCaption{ float: left; }
#keyboardMsg{ float: right; }
#closeButton{ top: 5px; right: 5px; }

#lightbox img{ border: none; clear: both;}
#overlay img{ border: none; }

#overlay{ background-image: url(overlay.png); }

* html #overlay{
background-color: #333;
back\ground-color: transparent;
background-image: url(blank.gif);
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=”overlay.png”, sizingMethod=”scale”);
}

« Previous entries