


//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('hover')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/hover (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/hover (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/hover (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();




/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

var win = null;
function NewWindow(mypage,myname,w,h,scroll,resize){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resize+' '
win = window.open(mypage,myname,settings)
}


//the end





//Defines bookmark/favourite details and messeges for different browsers

var bookmarkurl="http://www.crashedcomputer.co.uk/china/";
var bookmarktitle="Chinese Art Paintings. The Gallery of China for a Chinese Painting";

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle);

else if (window.sidebar) 
        alert('This feature only works for Internet Explorer, use Control+D to bookmark The-Gallery-Of-China.com');
        
else if( window.opera && window.print ) 
        alert('This feature only works for Internet Explorer, use Control+T to bookmark The-Gallery-Of-China.com');
}


/*Colorbox CallThis is for all inline contentthe link needs to be done like this...<a href="#blah" class="colorbox">blah</a>and the hidden div like this...<div class="details"><div id="blah" class="colorbox"></div></div>*/

	$("a.colorbox").click(function(){
		var href = "";
		href = $(this).attr("href");
		$(".colorbox").colorbox({width:"660px", inline:true, href:href});
		}
	);

