// JavaScript Document
var isOnline = window.location.protocol == 'http:';
var isIE6 = (typeof document.documentElement.style.maxHeight == "undefined");
var splitChr = isIE6  ? "\\" : '/';
function openDetail(targetUrl, targetHeight){
	var wWidth = 600;
	var wHeight = 600;
	var targetWin = 'detail';
	var param = 'scrollbars=yes,resizable=no,';
	var location = window.location;
	var urlSafix = location.protocol + '/'    ;
	var urlMiddle = location.hostname + '/';
	
	if(isOnline) {
		//targetUrl = 'http://canon.dog-cr.jp/eos_ef_090120/products/accessory/' + targetUrl;
		targetUrl = 'http://www.canon.com.cn/products/accessory/' + targetUrl;
	}else{
		var pathArray = location.pathname.split(splitChr);
		for(var i = 0; i < pathArray.length; i++) {
			if(pathArray[i] != 'products') {
				if(pathArray[i]!= undefined) {
					urlMiddle += pathArray[i];
					urlMiddle += '/';
				};
			}else{
				break;	
			}
		}
	//alert(urlMiddle);
		if(isIE6) {
			targetUrl = urlMiddle + 'products/accessory/' + targetUrl;
		}else{
			targetUrl = urlSafix + urlMiddle + 'products/accessory/' + targetUrl;
		}
	}
	
	//targetUrl = location.protocol + '//' + location.hostname + '/' + 
	//'products/accessory/' + targetUrl;
	//
	targetHeight = (targetHeight || wHeight);
	param += 'width=' + wWidth + ',height=' + wHeight;
	window.open(targetUrl, targetWin, param);
}
