function changeImg(path) {
	if(document.getElementById('bigimg').src!=path) {
	imgPreloader = new Image();
	
	// once image is preloaded, resize image container
	document.getElementById('bigimg').style.display="none";
	document.getElementById('loading_img').style.display="";
	imgPreloader.onload=function(){
	document.getElementById('loading_img').style.display="none";
	document.getElementById('bigimg').src=path;
	//document.getElementById('bigimg').style.display="";
	new Effect.Appear('bigimg',{ duration: 0.7, from: 0.0, to: 1.0});
	imgPreloader.onload=function(){};
	imgPreloader.src="";
	}
	imgPreloader.src=path;
	}
}

var msg = Object;
msg['toshulin_applications'] = 'Toshulin Applications Photos';
msg['toshulin_base'] = 'Toshulin Base, Column, Rail and Ram Photos';
msg['toshulin_chucking'] = 'Toshulin Chucking Solutions Photos';
msg['toshulin_guarding'] = 'Toshulin Machine Guarding Photos';
msg['toshulin_accessories'] = 'Toshulin Machine Accessories Photos';
msg['toshulin_pallet'] = 'Toshulin Pallet Changer Photos';
msg['toshulin_head'] = 'Toshulin Dual Head Machine Photos';
msg['toshulin_tooling'] = 'Toshulin Toolchanger and Tooling Photos';
msg['toshulin_photos'] = 'Toshulin Machine Photos';
msg['toshulin_facility'] = 'Toshulin Facility Photos';

var cmsg = Object;
cmsg['colgar_applications'] = 'Colgar Applications Photos';
cmsg['colgar_guarding'] = 'Colgar Machine Guarding - Size 3000 Machine';
cmsg['colgar_accessories'] = 'Colgar Machine Accessories Photos';
cmsg['colgar_pallet'] = 'Colgar Table and Pallet System Photos';
cmsg['colgar_head'] = 'Colgar Head Photos';
cmsg['colgar_tooling'] = 'Colgar Toolchanger Photos';
cmsg['colgar_photos'] = 'Colgar Machine Photos';
cmsg['colgar_facility'] = 'Colgar Facility Photos';

var qmsg = Object;
qmsg['qiqihar_applications'] = 'Qiqihar Applications Photos';
qmsg['qiqihar_base'] = 'Qiqihar Base, Column, Rail, and Ram Photos';
qmsg['qiqihar_guarding'] = 'Qiqihar Machine Guarding Photos';
qmsg['qiqihar_accessories'] = 'Qiqihar Machine Accessories Photos';
qmsg['qiqihar_head'] = 'Qiqihar Dual Head Machine Photos';
qmsg['qiqihar_tooling'] = 'Qiqihar Toolchanger and Tooling Photos';
qmsg['qiqihar_photos'] = 'Qiqihar Machine Photos';
qmsg['qiqihar_facility'] = 'Qiqihar Facility Photos';

var rmsg = Object;
rmsg['reform_applications'] = 'Reform Applications Photos';
rmsg['reform_base'] = 'Reform Bed, Headstock, and Tailstock Photos';
rmsg['reform_wheelheads'] = 'Reform Wheelhead Photos';
rmsg['reform_part'] = 'Reform Part Measurement Photos';
rmsg['reform_accessories'] = 'Reform Machine Accessories Photos';
rmsg['reform_photos'] = 'Reform Machine Photos';
msg['reform_facility'] = 'Reform Facility Photos';

function getElement(id) {
return document.getElementById ? document.getElementById(id) :
document.all ? document.all(id) : null;
}

function rollTextToshulin(which, state, textCellId) {
	var el = getElement(textCellId);
	if (el && typeof el.innerHTML != 'undefined') {
	if (state == 'on') el.innerHTML = msg['toshulin_' + which];
	}
}

function rollTextColgar(which, state, textCellId) {
	var el = getElement(textCellId);
	if (el && typeof el.innerHTML != 'undefined') {
	if (state == 'on') el.innerHTML = cmsg['colgar_' + which];
	}
}

function rollTextQiqihar(which, state, textCellId) {
	var el = getElement(textCellId);
	if (el && typeof el.innerHTML != 'undefined') {
	if (state == 'on') el.innerHTML = qmsg['qiqihar_' + which];
	}
}

function rollTextReform(which, state, textCellId) {
	var el = getElement(textCellId);
	if (el && typeof el.innerHTML != 'undefined') {
	if (state == 'on') el.innerHTML = rmsg['reform_' + which];
	}
}
	
function showDiv(cur_div){
			if(cur_div=="div_toshulin")
			{
			document.getElementById("div_toshulin").style.display="";
			document.getElementById("div_colgar").style.display="none";
			document.getElementById("div_qiqihar").style.display="none";
			document.getElementById("div_reform").style.display="none";
			
			document.getElementById("linkToshulin").className='photogallery_Hover';
			document.getElementById("linkColgar").className='photogallery';
			document.getElementById("linkQiqihar").className='photogallery';
			document.getElementById("linkReform").className='photogallery';
			
			changeImg(SITE_URL+'images/gallery/toshulin/applications/big.jpg');
			rollTextToshulin('applications','on','textmsg');
			}
			else if(cur_div=="div_colgar")
			{
			document.getElementById("div_toshulin").style.display="none";
			document.getElementById("div_colgar").style.display="";
			document.getElementById("div_qiqihar").style.display="none";
			document.getElementById("div_reform").style.display="none";
			
			document.getElementById("linkToshulin").className='photogallery';
			document.getElementById("linkColgar").className='photogallery_Hover';
			document.getElementById("linkQiqihar").className='photogallery';
			document.getElementById("linkReform").className='photogallery';
			
			changeImg(SITE_URL+'images/gallery/colgar/applications/big.jpg');
			rollTextColgar('applications','on','textmsg');
			}
			else if(cur_div=="div_qiqihar")
			{
			document.getElementById("div_toshulin").style.display="none";
			document.getElementById("div_colgar").style.display="none";
			document.getElementById("div_qiqihar").style.display="";
			document.getElementById("div_reform").style.display="none";
			
			document.getElementById("linkToshulin").className='photogallery';
			document.getElementById("linkColgar").className='photogallery';
			document.getElementById("linkQiqihar").className='photogallery_Hover';
			document.getElementById("linkReform").className='photogallery';
			
			changeImg(SITE_URL+'images/gallery/qiqihar/applications/big.jpg');
			rollTextQiqihar('applications','on','textmsg');
			}
			else if(cur_div=="div_reform")
			{
			document.getElementById("div_toshulin").style.display="none";
			document.getElementById("div_colgar").style.display="none";
			document.getElementById("div_qiqihar").style.display="none";
			document.getElementById("div_reform").style.display="";
			
			document.getElementById("linkToshulin").className='photogallery';
			document.getElementById("linkColgar").className='photogallery';
			document.getElementById("linkQiqihar").className='photogallery';
			document.getElementById("linkReform").className='photogallery_Hover';
			
			changeImg(SITE_URL+'images/gallery/reform/applications/big.jpg');
			rollTextReform('applications','on','textmsg');
			}
}

function popupImg (path){
		var popupwindow = window.open(SITE_URL+"html/static/"+path,'NewWin1','HEIGHT=603,WIDTH=651,left=50,top=40,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no,titlebar=no');
		popupwindow.focus();
}