function openWindow(elem, address, width, height, scrolling) {
	elem.href = 'javascript:void(0)';
	var scroll = "no";
	if (scrolling==true)
  		scroll = "yes";
  	preview = window.open(address, '', "width="+width+",height="+height+",scrollbars="+scroll);
  	preview.focus();
}
function disableLink(elem) {
	elem.href = 'javascript:void(0)';
	// alert(elem);
}
function replaceLink(elem, link) {
	elem.href = link;
}
function visiCounter(t,c,id) {
	var ajax = YAHOO.util.Connect.asyncRequest('GET', '/ajax/vis/count/t/'+t+'/c/'+c+'/id/'+id,{success:doNothing}); 
}
var doNothing = function() {};

function checkOwnerForm(kid) {
	if (document.getElementById('owner').checked) {
		window.location.href="/company/add/id/"+kid+"/owner/1";
	}
}
function showVideo(targetElemId,videoObjectIndex) {
	var elem = document.getElementById(targetElemId);
	var video = videoObjects[videoObjectIndex];
	if (elem!='undefined' && video!='undefined') {
		var html = '';
		if (typeof video.videoPlayerEmbedTag=='string') {
			html+=video.videoPlayerEmbedTag; 
		}
		else {
			html+='<div style="width: 425px; height: 242px; background: #CCC; position: relative;">';
			html+='<img src="'+video.thumbnailURL+'" style="width: 100%; height: 100%; position: absolute; top: 0;"/>';
			html+='<div style="position: absolute; bottom: 10px; left: 20px; width: 365px; padding: 10px; background: #CCC;">Dieses Video kann hier nicht angezeigt werden, bitte benutzen Sie den folgenden Link um das Video anzusehen:<br/>';
			html+='<a href="'+video.videoUrl+'" target="_blank">zum Video</a></div></div>';
		}
		html+='<div class="videoEntry" style="width: 405px; margin: 5px 10px;">';
		html+='<div class="videoData"><h3><a href="'+video.videoUrl+'" style="text-decoration: none">'+video.title+'</a></h3></div>';
		html+='<div class="videoData" style="padding-bottom: 10px">'+video.description+'</div>';
		if (typeof video.runtime=='string' && video.runtime>0) {
			var totalSeconds = parseInt(video.runtime);
			var minutes = Math.floor(totalSeconds/60);
			var seconds = totalSeconds - (minutes * 60);
			html+='<div class="videoData"><span class="label">Länge:</span><div class="value">'+minutes+":"+seconds+'</div></div>';
		}
		if (typeof video.channel=='string' && video.channel.length>0) {
			html+='<div class="videoData"><span class="label">Kanal:</span><div class="value">'+video.channel+' <a href="'+video.channelUrl+'">'+video.channelUrl+'</a></div></div>';
		}
		if (typeof video.category=='string' && video.category.length>0) {
			html+='<div class="videoData"><span class="label">Kategorie:</span><div class="value">'+video.category+'</div></div>';
		}
		if (typeof video.tags=='string' && video.tags.length>0) {
			html+='<div class="videoData"><span class="label">Suchbegriffe:</span><div class="value">'+video.tags+'</div></div>';
		}
		html+='<div class="videoData"><span class="label">Link:</span><div class="value"><a href="'+video.videoUrl+'">zum Video</a></div></div>';
		html+='</div>';
		elem.innerHTML = html;
	}
}
