// Make sure file is not hosted in a different frameset
if(top.location.href != window.location.href){
	top.location.href = window.location.href
}

function openWindow(url, w, h){
	var windowprops = "width=" + w + ",height=" + h +",,left=10,top=10,scrollbars=no,status=yes,toolbar=no,location=no,directories=no,resizable=yes";
	popup = window.open(url,'newWin',windowprops);
	popup.focus();
}

function switchClass(obj, strClassName){
	obj.className	= strClassName;
}

function gotoURL(strUrl){
	location = strUrl;
}

function copyrightYear(startYear){
	d = new Date();
	if(startYear != d.getFullYear()){
		return startYear + " - " + d.getFullYear();
	} else {
		return startYear;
	}
}

/*
 * change image source
 *
 * @param string mainImageId - image id
 * @param string imageUrl - url of the image that have to be put as a sourse to original image
 */
function changeMainImage(mainImageId, imageUrl) {
	var mainImage = document.getElementById(mainImageId);
	if(mainImage){
		// change image source to imageUrl
		mainImage.src = imageUrl;
	}
}

function ShowMagnifierFlash(){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="530" height="395" id="map" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="./images/map.swf" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="./images/map.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="530" height="395" name="map" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function ShowViewerFlash(companyID){
	document.write('<object type="application/x-shockwave-flash" data="emageview.swf" width="600" height="480">');
	document.write('<param name="movie" value="emageview.swf">');
	document.write('<param name="FlashVars" value="database=viewer_images.php?id=' + companyID + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="loop" value="false">');
	document.write('<param name="allowFullScreen" value="true">');
	document.write('</object>');
}
