
function loadVideoV2(path, img) {

	nWidth = 557;
	nHeight = 314;
	
	var s1 = new SWFObject('/global/utils/player.swf','player',nWidth,nHeight,'8');
	s1.addParam('allowfullscreen','true');
	s1.addParam('allowscriptaccess','always');
	s1.addParam('flashvars','image=/files/smimagedata/550x'+img+'&backcolor=ffffff&frontcolor=193647&autostart=false&file=' + path);
	s1.write('videocontent');
	
	windowG.center();
	windowG.show();
}

function goToVideoV2(id) {
	loadVideoV2(aVids[id]);
	actVid = id;
	
	if(actVid == 0)
		document.getElementById("prevbutton").style.display = "none";
	else	
		document.getElementById("prevbutton").style.display = "block";
		
	if(actVid == aVids.length - 1)
		document.getElementById("nextbutton").style.display = "none";
	else	
		document.getElementById("nextbutton").style.display = "block";
}

function positionVideoArrowV2( pk, image ) {
	
	if(document.getElementById('videoarrow' + pk)) {
		
		ar = document.getElementById('videoarrow' + pk);
	
		tp = image.height / 2 - 48 / 2;
		tp2 = image.width / 2 - 47 / 2;
		
		ar.style.position = "absolute";
		ar.style.top = parseInt (tp) + "px";
		ar.style.left = parseInt (tp2) + "px";
				
	}
	
}

function doVideoPopUpV2(path, img, title, bu, credit) {

	if (windowG) {
		windowG.destroy();
	}

	nWidth = 557;
	//nWinWidth = 640;
	
	nWinWidth = nWidth + 20;
	
	nGalleryWidth = nWidth;
	
	
	if(credit.length)
		sPipe = " | ";
	else
		sPipe = "";

	sBu = bu + sPipe + credit;
	if(sBu.length)
		sBu = '<div class="description"><div class="caption clearfix"><div class="flr">'+ sBu +'</div>		</div>		</div>';
	else
		sBu = '';
	
	
	windowG = new Ext.Window({       
		renderTo: Ext.getBody(),
		resizable:false,
		draggable:false,
		width: nWinWidth,
		cls: 'gallerypopup videopopup profilepopup ma-gallery',		
        minWidth: 300,
        minHeight: 200,    
        bodyStyle:'',
        buttonAlign:'center',
        items:	[{html:
					'	<div class="gallerypopup" style="width:'+nWidth+'px">'+
					'		<h1 style="margin:0px 0px 5px 0px; float: left;">'+ title +'</h1><br clear="all" />'+
					'		<div class="clearfix">'+
					'			<div id="videocontent"><img src="/files/smimagedata/550x'+img+'" /></div>'+
					'			<div class="fullsize" style="width:'+nWidth+'px;">'+
								sBu +
					'			</div>'+
					'		</div>'+
					'	</div>'							
				}],
		plain:false,
	    floating:true,
	    modal:true,
	    title:'<a style="cursor:pointer" class="mysitegallerydestroy" onclick="windowG.destroy()"><span class="flr" style="font-size:11px !important;padding-right:5px; padding-top:1px; color:#FFFFFF !important;">Schlie&szlig;en</span></a>',
	    shadow:false
    });
	//windowG.setPosition(200,75);
	windowG.center();
	windowG.show();	
	
	
	loadVideoV2(path, img);
}

function doFlashPopUp(path, title, bu, credit, img, flashwidth, flashheight) {

	if (windowG) {
		windowG.destroy();
	}
	
	
	//nWidth = 557;
	//nWinWidth = 640;	
	nWidth = flashwidth || 557;
	nWinWidth = nWidth + 20;
	
	//nGalleryWidth = 587;
	//nGalleryWidth = nWidth + 30;
	nGalleryWidth = nWidth;
	
	//nHeight = 314;
	nHeight = flashheight || 314;
	
	if(nWidth == 557){
		sImgGroup = '550x';	
	}
	else{
		sImgGroup = 'original';
	}
	
	
	if(credit.length)
		sPipe = " | ";
	else
		sPipe = "";
	
	windowG = new Ext.Window({       
		renderTo: Ext.getBody(),
		resizable:false,
		draggable:false,
		width: nWinWidth,
		cls: 'gallerypopup videopopup profilepopup',		
        minWidth: 300,
        minHeight: 200,    
        bodyStyle:'',
        buttonAlign:'center',
        items:	[{html:
        	'	<div class="gallerypopup" style="width:'+nGalleryWidth+'px">'+
			'		<h1 style="margin:0px 0px 5px 0px; float: left;">'+ title +'</h1><br clear="all" />'+
			'		<div class="clearfix" id="videocontent">'+
	        '			<div id="videocontent"><img src="/files/smimagedata/'+ sImgGroup + img +'" onclick="centerVideoGallery();"/></div>'+
			'			<div class="fullsize" style="width:'+nWidth+'px;"><div class="description"><div class="caption clearfix"><div class="flr">'+ bu + sPipe + credit +'</div>		</div>		</div></div>'+
			'		</div>'+
			'	</div>'		
									
				}],
		plain:false,
	    floating:true,
	    modal:true,
	    title:'<a style="cursor:pointer" class="mysitegallerydestroy" onclick="windowG.destroy()"><span class="flr" style="font-size:11px !important;padding-right:5px; padding-top:1px; color:#FFFFFF !important;">Schlie&szlig;en</span></a>',
	    shadow:false
    });
	
	var s1 = new SWFObject(path,'player',nWidth,nHeight,'8');
	s1.addParam('allowfullscreen','true');
	s1.addParam('allowscriptaccess','always');
	s1.write('videocontent');
	
	//windowG.setPosition(200,75);
	windowG.center();
	windowG.show();	

}

function doImagePopUp(path, title, bu, credit, width) {

	if (windowG) {
		windowG.destroy();
	}

	//nWidth = 550;
	//nWinWidth = 590;	
	nWidth = width || 550;
	
	nWinWidth = nWidth + 20;	
	

	
	if(credit.length)
		sPipe = " | ";
	else
		sPipe = "";
	
	windowG = new Ext.Window({       
		renderTo: Ext.getBody(),
		resizable:false,
		draggable:false,
		width: nWinWidth,
		cls: 'gallerypopup videopopup profilepopup',		
        minWidth: 300,
        minHeight: 200,    
        bodyStyle:'',
        buttonAlign:'center',
        items:	[{html:
        	'	<div class="gallerypopup" style="width:' + nWidth + 'px">'+
			'		<h1 style="margin:0px 0px 5px 0px; float: left;">'+ title +'</h1><br clear="all" />'+
			'		<div class="clearfix">'+
	        '			<img onLoad="centerVideoGallery()" src="'+ path +'" />'+
			'			<div class="fullsize" style="width:'+nWidth+'px;"><div class="description"><div class="caption clearfix"><div class="flr">'+ bu + sPipe + credit +'</div>		</div>		</div></div>'+
			'		</div>'+
			'	</div>'		
									
				}],
		plain:false,
	    floating:true,
	    modal:true,
	    title:'<a style="cursor:pointer" class="mysitegallerydestroy" onclick="windowG.destroy()"><span class="flr" style="font-size:11px !important;padding-right:5px; padding-top:1px; color:#FFFFFF !important;">Schlie&szlig;en</span></a>',
	    shadow:false
    });
	//windowG.setPosition(200,75);

	windowG.show();	

}

function centerVideoGallery() {
	
	windowG.center();
	
	
	var Pos = windowG.getPosition();
	var x = Pos[0];
	var y = Pos[1];
		
	if (x < 0){
		x = 0;
	}
	
	if (y < 0){
		y = 0;
	}
	
	if (x==0 || y==0){
		windowG.setPosition(x,y);
	}
	windowG.show();
}