//
// (c) 2007 webActive
//

function resizeWindow()
{
    var windowHeight = (isIE() ? document.documentElement.clientHeight : window.innerHeight);
    var contentHeight = $('ContentsContainer').offsetHeight;
    var flashcontentHeight = $('flashcontent').offsetHeight;

    var windowWidth = (isIE() ? document.documentElement.clientWidth : window.innerWidth);
    var contentWidth = $('ContentsContainer').offsetWidth;
    var flashcontentWidth = $('flashcontent').offsetWidth;

    // widescreen mysterious calculations
	
	var minContentHeight = 600;
	var maxContentHeight = 750;
	var minStripesHeight = 100;
	
	if (minContentHeight + minStripesHeight > windowHeight)
		var newHeight = windowHeight;
	else
		var newHeight = Math.min(maxContentHeight, windowHeight - minStripesHeight);
	
	//
	
	$('ContentsContainer').style.height = newHeight + 'px';
    $('flashcontent').style.height = newHeight + 'px';
    
    $('ContentsContainer').style.width = Math.max((960), windowWidth) + 'px';
    $('flashcontent').style.width = Math.max((960), windowWidth) + 'px';
    
    $('ContentsContainer').style.marginTop = Math.max(0, (windowHeight - newHeight) / 2) + 'px';
}

function changeFlashContentHeight(pixels)
{
    var windowHeight = (isIE() ? document.documentElement.clientHeight : window.innerHeight);
    var contentHeight = $('ContentsContainer').offsetHeight;
    var flashcontentHeight = $('flashcontent').offsetHeight;
    
    MinPixels = pixels;
    
    var ccHeight = Math.max((pixels), windowHeight);
    $('ContentsContainer').style.height = ccHeight + 'px'
    $('gapa').style.height = $('flashcontent').style.height = (ccHeight) + 'px';
}

function thisMovie(movieName)
{
    return isIE() ? window[movieName] : document[movieName];
}

function showPhoto(filename, photowidth, photoheight)
{
	alert(filename + ', ' + photowidth + ', ' + photoheight);
}

function showPhoto(file, w, h)
{
	var look = '';
	var sbars = 0;
	var resize = 0;
	var title = 'GapaFashion';

	file = './download/newsfiles/' + file;

	if(w > screen.availWidth)
	{
		w = screen.availWidth-30;
		sbars = 0;
		resize = 1;
	}
	if(h > screen.availHeight)
	{
		h = screen.availHeight-60;
		sbars = 0;
		resize = 1;
	}

	if(typeof(newWin)=='object')
	{
		if(newWin.closed);
		else
		{
			newWin.resizeTo(w, h);
		}
	}
	
	xpos = (screen.availWidth / 2)-(w / 2);
  	ypos = (screen.availHeight / 2)-(h / 2);

 	look = 'scrollbars='+sbars+', resizable='+resize+', width='+w+',height='+h+', left='+xpos+', top='+ypos;
    newWin = window.open(file,'newWinodow','toolbar=0,statusbar=0,location=0,'+look);
	newWin.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html><head><title>"+title+"</title><style type = \"text/css\">body, html { margin: 0; padding: 0; border: 0; background-color: #F2F1F1 }</style></head>");
	newWin.document.write("<body><img src='" +file+ "' onClick='window.close();' border=0 alt='"+title+"' />");
	newWin.document.write("</body></html>");
	newWin.focus();
	newWin.document.close();
}

function showPhoto2(file, w, h)
{
	var look = '';
	var sbars = 0;
	var resize = 0;
	var title = 'GapaFashion';

	if(w > screen.availWidth)
	{
		w = screen.availWidth-30;
		sbars = 0;
		resize = 1;
	}
	if(h > screen.availHeight)
	{
		h = screen.availHeight-60;
		sbars = 0;
		resize = 1;
	}

	if(typeof(newWin)=='object')
	{
		if(newWin.closed);
		else
		{
			newWin.resizeTo(w, h);
		}
	}
	
	xpos = (screen.availWidth / 2)-(w / 2);
  	ypos = (screen.availHeight / 2)-(h / 2);

 	look = 'scrollbars='+sbars+', resizable='+resize+', width='+w+',height='+h+', left='+xpos+', top='+ypos;
    newWin = window.open(file,'newWinodow','toolbar=0,statusbar=0,location=0,'+look);
	newWin.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html><head><title>"+title+"</title><style type = \"text/css\">body, html { margin: 0; padding: 0; border: 0; background-color: #F2F1F1 }</style></head>");
	newWin.document.write("<body><img src='" +file+ "' onClick='window.close();' border=0 alt='"+title+"' />");
	newWin.document.write("</body></html>");
	newWin.focus();
	newWin.document.close();
}

