// ============================================================================================================================
var maxAncho_Pic = 250; 
var maxAlto_Pic = 173 ;
var maxAncho_Logo = 180; 
var maxAlto_Logo = 135; 
var maxAncho_Pic_B = 208; 
var maxAlto_Pic_B = 156; 
var maxAncho_Pic_C = 70; 
var maxAlto_Pic_C = 70; 

function ImageResize(myimage,image_type)
{
var maxAncho,  maxAlto;
var forma, porcientoAnchura, porcientoAltura;
 					
		if (image_type==1) 
			{
				maxAncho = maxAncho_Pic;
				maxAlto = maxAlto_Pic;
			}
		else if (image_type==2)
			{//alert (myimage.width)
				maxAncho= maxAncho_Logo;
				maxAlto= maxAlto_Logo;
			}
			else if (image_type==3)
			{//alert (myimage.width)
				maxAncho= maxAncho_Pic_B;
				maxAlto= maxAlto_Pic_B;
			}
			else if (image_type==4)
			{//alert (myimage.width)
				maxAncho= maxAncho_Pic_C;
				maxAlto= maxAlto_Pic_C;
			}
		if (myimage.width > myimage.height) {forma = 'horizontal';}
		if (myimage.width < myimage.height) {forma = 'retrato';}
		if (myimage.width == myimage.height) {forma = 'cuadrado';}
		if(forma == 'horizontal')
			{
					if(myimage.width > maxAncho)
						{
						porcientoAnchura = parseInt(maxAncho/myimage.width*100);
						myimage.width = maxAncho;
						//myimage.height = (porcientoAnchura*myimage.height)/100;
						}
			}
		else if (forma == 'retrato')
			{
			if (myimage.height > maxAlto)
				{
				porcientoAltura = parseInt(maxAlto/myimage.height*100);
				myimage.height = maxAlto;
//				myimage.width = porcientoAltura*myimage.width/100;
				}
			}
			else if (forma == 'cuadrado')
				{
					if (maxAncho >= maxAlto)
					{
					myimage.width = maxAncho;
//					myimage.height = maxAncho;
					}
					else
					{
					myimage.width = maxAlto;
//					myimage.height = maxAlto;
					}
				}
		//	alert (image_type);
//			 alert (myimage.width);
}



// ============================================================================================================================
// ============================================================================================================================
// this code makes the pop up of the image as its original size

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=50,height=100,left='+PositionX+',top='+PositionY;

function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>'+imageTitle+'</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function getacopyright(){ alert("Všechna práva vyhrazena  © 2005 AGP Production s.r.o.");}')
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=120-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=19+document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');

//if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
//else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
if (!AutoClose) writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();self.focus()" oncontextmenu="getacopyright()">')
else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();" >');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

function CheckType(imageURL,imageTitle,TypeDoc){
if (TypeDoc!='jpg') {
window.open(imageURL,"","height=200,width=300"); 
close();
}
else{
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>'+imageTitle+'</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function getacopyright(){ alert("Všechna práva vyhrazena  © 2005 AGP Production s.r.o.");}')
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=120-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');

//if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
//else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
if (!AutoClose) writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();self.focus()" oncontextmenu="getacopyright()">')
else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();" oncontextmenu="getacopyright();return false;">');
writeln('<img name="George" src='+imageURL+' onClick="getacopyright();return false;" onmousedown="getacopyright();return false;" style="display:block"></body></html>');
close();		
}
}
}


// ============================================================================================================================
function openindex()
      { 
OpenWindow=window.open("", "http://www.seznam.cz", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Title Goes Here</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=pink>")
OpenWindow.document.write("<h1>Hello!</h1>")
OpenWindow.document.write("This text will appear in the window!")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")

OpenWindow.document.close()
self.name="main"
     }


function LoginPopWIn(){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>yes yes</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function getacopyright(){ alert("Všechna práva vyhrazena  © 2005 AGP Production s.r.o.");}')
writeln('function reSizeToImage(){');writeln('if (isIE){');
writeln('window.resizeTo(310,243);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="titulo";}');writeln('</sc'+'ript>');

//if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
//else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
if (!AutoClose) writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();self.focus()" oncontextmenu="getacopyright()">')
else {
	writeln('</head>');
	writeln('<frameset rows="60,183" frameborder="NO" border="0" framespacing="0">');
	writeln('<frame name="TopFrame" border="0" src="/scripts/detail.asp?id=156" marginwidth="0" marginheight="0" onload="reSizeToImage();" >');
	writeln('<frame name="DownFrame" border="0" src="/scripts/modules/registration/login.asp" marginwidth="0" marginheight="0" onload="reSizeToImage();" >');
	writeln('</frameset>');
	writeln('<noframes>');
	writeln('<body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();" oncontextmenu="getacopyright();return false;">');
	}
writeln('</noframes>');
writeln('</html>');
close();		
}
}
// ============================================================================================================================
//Image Change onmouseover

function roll_over(img_name, img_src)
   {
   document[img_name].src = img_src;
   }
   
function border_over(img_name,img_class )
   {
	   
   document[img_name].border = img_border;
   document.getElementById(img_name).style.bordercolor = "#ff4000";
   }


// ============================================================================================================================
//Image Protection, partially protect the images from being copied. This script disables the dragging also

var specialcase = ((navigator.userAgent.indexOf('Mac') != -1) || document.all)
var flag = 0;
var msg = 'This image is protected by copyright.\nWe request you not to copy it.';
var x,y,x1,y1,copyAttempt;

function init()
{
	if (!(document.getElementById || document.all || document.layers)) return;
	if (specialcase && document.layers)
	{
		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = special;
	}
	for (i=0;i<document.images.length;i++)
	{
		document.images[i].onmousedown = checkIt;
		document.images[i].onmouseup = function() {return false};
		if (specialcase)
		{
			document.images[i].onmousemove = special;
			document.images[i].onclick = clearIt;
		}
	}
}

function checkIt(e)
{
	copyAttempt = 0;
	if (window.Event)
	{
		x = e.screenX;
		y = e.screenY;
		theButt = (e.which == 3);
	}
	else
	{
		x = window.event.clientX;
		y = window.event.clientY;
		theButt = (window.event.button == 2);
	}
	if (theButt)
	{
		copyAttempt = 1;
		flag = 0;
		alert(msg);
		return false; // NN4 only
	}
	if (specialcase) flag = 1;
	return false;
}

function special(e)
{
	theObj = '';
	if (window.Event)
	{
		x1 = e.screenX;
		y1 = e.screenY;
		if (e.target.parentNode) theObj = e.target.parentNode.tagName;
	}
	else
	{
		x1 = window.event.clientX;
		y1 = window.event.clientY;
		theObj = window.event.srcElement.parentElement.tagName;
	}
	var isLink = (theObj == 'A');
	if (flag && (!isLink || ((Math.abs(x-x1) > 10) || (Math.abs(y-y1) > 10))))
	{
		copyAttempt = 1;
		flag = 0;
		alert(msg);
		return false;
	}
}

function clearIt()
{
	flag = 0;
	if (copyAttempt)
	{
		copyAttempt = 0;
		return false;
	}
}
// ============================================================================================================================

