	var blnusebuttontext = true;
	var chosenObj;
	var chosenArray = new Array()
	var CtrlDown = false;
	var BasketArray = new Array()
	var DownloadArray = new Array()
	var SelectedPptObj;
	var pptMove = false 
	var oldQuality="";
	var selectedQualityFormatId = 0;
	var assetOverObj;

	function WebHelp(ident)
	{
		window.open("WebHelp.aspx?id="+ident,'','height=550,width=800,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes'); 
	}
	
				
	function showdropdowns()
	{
		document.getElementById("ProduktlinjeListbox").style.visibility="visible";
		document.getElementById("OpstillingListbox").style.visibility="visible";
		document.getElementById("SortimentListbox").style.visibility="visible";
		document.getElementById("AndvendelseListbox").style.visibility="visible";
	}
	
	function hidedropdowns()
	{
		document.getElementById("ProduktlinjeListbox").style.visibility="hidden";
		document.getElementById("OpstillingListbox").style.visibility="hidden";
		document.getElementById("SortimentListbox").style.visibility="hidden";
		document.getElementById("AndvendelseListbox").style.visibility="hidden";
	}
	
	
	function PreviewImage(image)
	{
		window.open('previewimage.aspx?filename='+image,'','height=100,width=100,status=yes,toolbar=no,menubar=no,location=no');
	}
	
	function PreviewImagePdf(image,iconSource)
	{
		if (iconSource.indexOf('_pdf.')!=-1)
		{
			setTimeout('PDFFileDownload()',200)
		}
		else
		{
			window.open('previewimage.aspx?filename='+image,'','height=100,width=100,status=yes,toolbar=no,menubar=no,location=no');
		}
	}
	
	function showBigPreview(obj)
	{
		var formatid = selectedQualityFormatId.split('_')[1]
		var SortHvid = ",26,31,25,27,28,"
		if (SortHvid.indexOf(formatid)> -1)
			window.open('imagepop.aspx?filename='+obj.bigPreviewsh+'&assetid='+obj.assetid+'&formatid='+formatid+'&image='+obj.originalPixels,'','top=0,height=100,width=100,resizable=no')
		else
			window.open('imagepop.aspx?filename='+obj.bigPreview+'&assetid='+obj.assetid+'&formatid='+formatid+'&image='+obj.originalPixels,'','top=0,height=100,width=100,resizable=no')
			
	}
	
	function assetOut(obj) 
	{
		// sets the defaultclass for asset and hides the tooltip
		if (obj.className != 'assetclicked')
			obj.className = 'assetout'
		hidedelaytip()
	}
		
	function assetOver(obj)
	{
		// sets the class for when over the asset and shows the tooltip after delay-time
		if (obj.className != 'assetclicked')
		{	
			obj.className = 'assetover'
		}
		assetOverObj = obj;
		getToolContent("assetTooltip"+ obj.assetid + '@' + obj.mediaFormatId,obj.assetid)
		showdelaytip("assetTooltip"+ obj.assetid + '@' + obj.mediaFormatId ,false,700)
	}
	
	function assetClicked(obj)
	{
		//Is called when asset is clicked
		if (obj != chosenObj)
		{
			obj.className = 'assetclicked'
			obj.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.firstChild.className = 'assetbottomClicked'
			if (chosenObj != null && !CtrlDown )
				ResetArrayObject(chosenArray)
			
			if (!CtrlDown) // Checks if Ctrl-key is down, if it is then it will be added to array
			{
				addToArray(chosenArray,obj,0)
				chosenObj = obj
			}
			else // It starts a new array
			{
				if (CtrlDown && obj.assetTypeId==5)//assetTypeId==2 is powerpoint-assests
				{	
					addToArray(chosenArray,obj,0)
					chosenObj = obj
				}
				else
				{	
					CtrlDown = false;
					alert('You can only group Powerpoints')						
					addToArray(chosenArray,obj,0)
					ResetArrayObject(chosenArray) //resets the array
					chosenObj = null;//resets the obj
				}
			}	
		}
	}
	
	function assetOnDblClick(obj) 
	{
		//On assets doubleclicked event. This function has diffrent functionality according to assettype 
		chosenObj = obj;								
		switch(parseInt(obj.assetTypeId))
		{					
			case 1: //video-asset
				playVideo()
				break;
			case 5: // powerpoint
				//alert(obj.bigPreview);
				AddToBasket(chosenArray);
				document.getElementById('workarea').style.display='';						
				break;
			case 4://Image
				downloadFile()
				break;	
			default:
				alert('default:'+obj.assetTypeId)		
			
		}
	}
	
	function ResetArrayObject(arrayObj)
	{
		//resetsThe current array
		if (arrayObj != null)
		{
			for (var i = 0; i < (arrayObj.length);i++)
			{
				if (arrayObj[i]!= null)
					ResetObject(arrayObj[i])
			}
		}
		chosenArray = Array();
	}
	
	function ResetObject(obj)
	{
		//resets only the asset
		obj.className = 'assetOut'
		obj.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild.nextSibling.nextSibling.firstChild.className = 'assetbottom'
		chosenObj = null
	}
	
	function showDownloadAnimation()
	{
		//Waiting animation turns visible when called before downloading an asset
		//document.getElementById('downloadAnimation').style.display = ''		
	}
	
	function hideDownloadAnimation()
	{
			//Waiting animation turns invisible when downloading an asset
			document.getElementById('downloadAnimation').style.display = 'none'		
	}
	
	function downloadFile()
	{
		//createing the download html for multible qualities
		
		if (chosenArray.length > 1)
		{
			alert('Choose only one file to download');
		}
		else
		{
			//alert('downloadFile')	
			if (chosenObj != null)
			{	
				if (chosenObj.assetTypeId != 1)
				{
					//alert(chosenObj.isPDf)	
					
					var htmlString = "<table cellspacing=10 cellpadding=0 width=100% border=0>";
					htmlString += '<td valign=top align=left>'+chosenObj.innerHTML+'</td>';
												
					//var QualityArray = eval('assetQualities'+chosenObj.assetid).split('¤') //set in codebehind
					
					var QualityArray = chosenObj.assetqualities.split('$');
				//	alert('###'+QualityArray)
					var QualityHTML = ''
					
					QualityHTML += "<table cellspacing=0 cellpadding=0 class=assetbottom border=0 >"
					var checked = ""
					
					//*** START *** HARDCODET sorting only for LMG ***
					/*if(chosenObj.assetTypeId==4)
					{
						QualityArray.splice(1,0,QualityArray[QualityArray.length-1])
						QualityArray.splice(1,0,QualityArray[QualityArray.length-2])
						QualityArray.splice(6,2);
					}*/
					// *** END *** HARDCODET sorting only for LMG ***
					//alert('downloadFile2')	
					for(var i = 1; i < QualityArray.length;i++)    
					{
						if (i==1)
						{
							selectedQualityFormatId = QualityArray[i].split('@')[0]
							checked = "Checked"
						}
						else
							checked = ""
						QualityHTML += "<tr><td valign=top><input onclick=\"selectedQualityFormatId = this.value\" "+checked+" type=radio name=\"Assetradio"+chosenObj.assetid+"\" value=\""+QualityArray[i].split('@')[0]+"\"></td><td align=left>"+QualityArray[i].split('@')[1]+"</td></tr>"	
					}
					QualityHTML += "</table>"
					htmlString += '<td valign=top>'+QualityHTML+'</td>';	
					if (chosenObj.isPDf == "true"){ 
						document.getElementById('workarea').innerHTML = htmlString+'<tr><td style=\"padding-left:0px;\">&nbsp;</td><td onclick=FileDownload(chosenObj)><button onblur="hideDownloadAnimation()" onclick="showDownloadAnimation()" class=buttonclass>DOWNLOAD</button></td></tr><tr><td></td><td><div id="downloadAnimation" style="display:none;position:absolute"><img src="images/timeglass.gif"></div></td></tr></table>'
					}else{
						document.getElementById('workarea').innerHTML = htmlString+'<tr><td style=\"padding-left:0px;\"><button onclick="showBigPreview(chosenObj)" class=buttonclass>CROP</button></td><td onclick=FileDownload(chosenObj)><button onblur="hideDownloadAnimation()" onclick="showDownloadAnimation()" class=buttonclass>DOWNLOAD</button></td></tr><tr><td></td><td><div id="downloadAnimation" style="display:none;position:absolute"><img src="images/timeglass.gif"></div></td></tr></table>'
					}
					document.getElementById('sendPpEmail').style.display='none';
					//document.getElementById('flashcutter').style.display='none';
					document.getElementById('workarea').style.display='';
					document.getElementById('FotoCollector').style.display='';
					document.getElementById('headlineCollector').innerHTML = "ASSET CHOSEN FOR DOWNLOAD";
				}else{
					alert("Video assets cannot be downloaded");
				}
			}	
			else
				alert('Choose Asset first');
		}
	}
	
	function FileDownload(obj)
	{
		//calls the downloadpage with needed information. 
		var radioArray = document.getElementsByName('Assetradio'+obj.assetid)
		var checkedRadioValue = ""
		for(var i = 0;i < radioArray.length;i++)
		{
			if (radioArray[i].checked)
			{
				checkedRadioValue = radioArray[i].value
			}
		}
		if (checkedRadioValue != "")
			document.location.href='downloadfile.aspx?filename='+checkedRadioValue
		
	}
	
	function PDFFileDownload()
	{
		var QualityArray = chosenObj.assetqualities.split('$');
		var obj = chosenObj
		var checkedRadioValue = ""
		if (QualityArray.length>0)
			checkedRadioValue = QualityArray[1].split('@')[0]
		if (checkedRadioValue != "")
			document.location.href='downloadfile.aspx?filename='+checkedRadioValue
	}
	
	function playVideo()
	{
		//Plays a video (mms://) in windows default player				
		if (chosenArray.length > 1)
		{
			alert('Choose only one file to play');
		}
		else
		{					
			if (chosenObj != null)
			{										
				if (parseInt(chosenObj.assetTypeId) == 1){						
					//alert(chosenObj.outputName);
					
					var outHtml = "";
					outHtml += "Please select the desired quality that best complies with your internetconnection.<br><br>";
											
					var arr = "";
					arr = chosenObj.outputName.split(";");
					var mmsUrl = "";							
					
					// 128 kb
					mmsUrl = chosenObj.mmsbasePath + arr[0];
					outHtml += "<a href='" + mmsUrl + "'><img src='images/arrow_left_search.gif' border=0> 128 kb (low)<a/><br>";
					
					// 256 kb
					mmsUrl = chosenObj.mmsbasePath + arr[1];
					outHtml += "<a href='" + mmsUrl + "'><img src='images/arrow_left_search.gif' border=0> 256 kb (medium)<a/><br>";
					
					// 128 kb
					mmsUrl = chosenObj.mmsbasePath + arr[2];
					outHtml += "<a href='" + mmsUrl + "'><img src='images/arrow_left_search.gif' border=0> 512 kb (high)<a/>";
					
					
					document.getElementById('headlineCollector').innerHTML = "ASSET CHOSEN FOR VIEWING IN PLAYER";
					document.getElementById('workarea').innerHTML = outHtml;
					document.getElementById('sendPpEmail').style.display='none';							
					document.getElementById('workarea').style.display='';
					document.getElementById('FotoCollector').style.display='';
					
					
					//var mmsUrl = chosenObj.mmsbasePath + chosenObj.outputName							
					//document.location = mmsUrl;
				}else{
					alert("Only video assets is allowed, for this action");
				}																		
			}	
			else
				alert('Choose Asset first');
		}
	}
	
	function SetKeyCtrl(e)
	{
		//Checking for Ctrl-key(key-code=17)
		if (e.keyCode == 17)
			CtrlDown = true
	}
	
	function ReSetKeyCtrl()
	{
		CtrlDown = false
	}
	
	function addToArray(arrayObj, element, index)
	{
		arrayObj[arrayObj.length] = element
	}
	
	function AddToBasket(ArrayObj)
	{							
		//Adding powerpoint to basket
		for (var i=0; i < ArrayObj.length; i++)
		{
			if (ArrayObj[i] != null)
			{
				AllreadyInArray = false
				isPowerpoint = true
				for (var x = 0; x < BasketArray.length;x++)
				{
					if (BasketArray[x].assetid==ArrayObj[i].assetid)
						AllreadyInArray = true
				}
				if(parseInt(ArrayObj[i].assetTypeId) != 4 && parseInt(ArrayObj[i].assetTypeId) != 5)
				{
					alert('Only image-documents can be used i basket \n This document is excluded: '+ArrayObj[i].name )
					isPowerpoint = false
				}
				if (!AllreadyInArray && isPowerpoint)
				{
					BasketArray[BasketArray.length] = ArrayObj[i]
				}
				
				if (AllreadyInArray)
				{
					alert('document is allready in basket')
				}
			}
			
		}
		
		if (BasketArray.length > 0)
		{
			document.getElementById('sendPpEmail').style.display='';
			document.getElementById('FotoCollector').style.display='';
		}
		else	
		{
			document.getElementById('sendPpEmail').style.display='none';
			document.getElementById('FotoCollector').style.display='none';
		}
		
		ResetArrayObject(chosenArray)
		showBasket()
	}
	
	
/*	
	function setOldQuality(obj)
	{
		oldQuality = obj.value
	}
*/	
	

	
function clearAssetList(){				
	document.getElementById('assetlist').innerHTML = "&nbsp;";				
}


function pptObject(assetid, assetTypeId, preview, name, strHTML, locationstring, outputName, qualityList)
{
	//Basket-Object-container for generating the basket without having the objects (EX. after search)
	this.assetid = assetid;
	this.assetTypeId = assetTypeId;
	this.preview = preview;
	this.name = name;
	this.innerHTML = strHTML;
	this.locationstring = locationstring
	this.outputName = outputName
	this.assetqualities = qualityList
}
	

	
function createPptAsset(assetid, assetTypeId, previewPath, assetName )
{

	//Creates one powerpointassets HTML from arrayinfo-field-data (used in createBasket() )
	//var QualityArray = eval('assetQualities'+assetid).split('¤') //set in codebehind
	var HTMLstring = ""	
	HTMLstring += "<table cellspacing=0 cellpadding=0 border=0><tr><td valign=top>";
	HTMLstring += "<table cellspacing=0 cellpadding=0 border=0>";
	HTMLstring += "<tr>";
	HTMLstring += "<td class=\"assettop\"><img src=\"images/assetimage"+assetTypeId+".gif\"></td>";
	HTMLstring += "</tr>";
	HTMLstring += "<tr>";
	HTMLstring += "<td class=\"assetimage\"><img height=71 width=94 src=\""+previewPath+"\"></td>";
	HTMLstring += "</tr>";
	HTMLstring += "<tr>";
	if (assetName.length > 13)
		HTMLstring += "<td class=assetbottom>"+assetName.substr(0,10)+"...</td>";
	else
		HTMLstring += "<td class=assetbottom>"+assetName+"</td>";
	
	HTMLstring += "</tr>";
	HTMLstring += "</table></td>";
	/*HTMLstring += "<td><table cellspacing=0 cellpadding=0 class=assetbottom border=0 >"
	for(var i = 1; i < QualityArray.length;i++)    
			{
				if (i==1)
					checked = "Checked"
				else	
					checked = ""
				HTMLstring += "<tr><td valign=top><input "+checked+" type=radio name=\"Assetradio"+assetid+"\" value=\""+QualityArray[i].split('@')[0]+"\"></td><td align=left>"+QualityArray[i].split('@')[1]+"</td></tr>"	
			}
	
	HTMLstring += "</table></td>";
	*/
	HTMLstring += "</tr>";
	HTMLstring += "</table></td>";
	return HTMLstring
	
}
	
	
	
function onclickPpt(obj)
{
	//V2.0 movement of ppt in basketarea
	divObj = document.getElementById('pptMoveDiv');
	if(divObj.innerHTML != '')
		swapPpt(obj)
	else
	{
		if (BasketArray.length > 1)
		{
			divObj.innerHTML = obj.innerHTML
			divObj.style.display = '';
			SelectedPptObj = obj;
			pptMove = true
		}
	}
	
}
	
function mouseMovePpt(e)
{
	// V2.0 movement of ppt in basketarea
	if (pptMove)
	{
		obj = document.getElementById('pptMoveDiv');
		obj.style.top = event.clientY + document.body.scrollTop
		obj.style.left = event.clientX + document.body.scrollLeft
	}
}

function swapPpt(obj)
{
	// V2.0 movement of ppt in basketarea and swapping places in basketarray
	divObj = document.getElementById('pptMoveDiv');
	var tempObj = BasketArray[SelectedPptObj.arrayIndex]  
	BasketArray[SelectedPptObj.arrayIndex] = BasketArray[obj.arrayIndex]
	BasketArray[obj.arrayIndex] = tempObj
	divObj.innerHTML = '';
	showBasket();
	pptMove = false
}

function deletePpt(obj)
{
	// V2.0 movement of ppt in basketarea and deleting
	BasketArray.splice(parseInt(obj.arrayIndex),1)
	divObj.innerHTML = '';
	showBasket();
	pptMove = false
}
	
function editVideo()
{
	//calls the edit video layer and cutter.swf
	if (chosenObj != null)
	{	
		if (chosenObj.assetTypeId == 1)
		{
			document.getElementById('flashcutter').style.display='';
			document.getElementById('workarea').style.display='none';
			document.getElementById('sendPpEmail').style.display='none';
			if (chosenObj != null)
			{
				changeVideo("Video"+chosenObj.assetid, chosenObj.assetid, chosenObj.basePath + chosenObj.outputName)
			}
		}
		else
		{
			alert("Invalid format")
		}
	}	
	else
		alert('Choose Asset first');
}
	
// Login scripts
function showLogonFields(){			
	document.getElementById('logonfields').style.display='';
	document.getElementById('logon').style.display='none';						
	
	document.getElementById('introHeadline').innerHTML = "LOGON";
}
	
function SectionSwap(obj,imgObj){				
	if (document.getElementById(obj).style.display == ""){			
		document.getElementById(obj).style.display='';
		document.getElementById(obj).style.display='none';
		imgObj.src = "images/arrow_down_search.gif";
	}else{
		document.getElementById(obj).style.display='';					
		imgObj.src = "images/arrow_left_search.gif";					
	}									
}





var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

function getToolContent(objID,assetid)
{
	
	xmlhttp.open("GET", XMLHTTPURL + "?assetid="+assetid,true);
	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4) {
			//alert(xmlhttp.responseText);
			//alert('lige HER'+document.getElementById('assetTooltip7189@29'))
			if (document.getElementById(objID).innerHTML.indexOf('metadataAdded')==-1)
			{
				document.getElementById(objID).innerHTML += xmlhttp.responseText;
				document.getElementById(objID).innerHTML += "<div style='display:none'>metadataAdded</div>";
			}
		}
	}
	xmlhttp.send(null)
}




//window.onload = 



function closeSubsOLD(obj,count,img,blockId)
{
	var Display				
	//if (obj.parentNode.nextSibling.style.display == ""){
		Display = "none";
		document.getElementById(img).src = "images/arrow_down_search.gif";
	//}
	/*else{
		Display = "";
		document.getElementById(img).src = "images/arrow_left_search.gif";
	}*/			

	var currentTR = obj.parentNode
	//alert(blockId)
	
	for(var i=0;i < count;i++ )
	{
		//alert(currentTR.nextSibling.id.indexOf(blockId))
		if(currentTR.nextSibling){
			if (currentTR.nextSibling.id.indexOf(blockId)>-1){
				currentTR.nextSibling.style.display = Display
			}
			currentTR = currentTR.nextSibling
		}
	}
}

function ObjOpen()
{
	this.obj;
	this.count;
	this.img;
	this.blockId;  
} 

function OpenSubsAfterSubmit()
{
	var CurrentObj = document.getElementById('catTD').parentNode
	//alert('her'+StartObj.parentNode.nextSibling)
	var CurrentSectionOBj = CurrentObj.firstChild
	while (CurrentObj.nextSibling!=null)
	{
		if (CurrentObj.firstChild.nextSibling==null) {
			CurrentSectionOBj = CurrentObj.firstChild
		}
		else
			{
				switch(CurrentObj.firstChild.nextSibling.firstChild.nodeName)
				{
					case "SELECT":
						if(CurrentObj.firstChild.nextSibling.firstChild.selectedIndex)
						{
							if(CurrentObj.style.display == "none")
								CurrentSectionOBj.click()
						}
					break;
					
					case "INPUT":
						if(CurrentObj.firstChild.nextSibling.firstChild.value.length>0)
						{
							if(CurrentObj.style.display == "none")
								CurrentSectionOBj.click()
						}
					break;
				}
			}
			
		CurrentObj = CurrentObj.nextSibling
	}
}
//setTimeout('',300);

function closeSubs(obj,count,img,blockId)
{
	
	if (groupid && groupid>0){
	if (ObjOpen.obj!=null && ObjOpen.obj != obj)
	{
		closeSubs(ObjOpen.obj,ObjOpen.count,ObjOpen.img,ObjOpen.blockId)
	}
	
	var Display				
	if (obj.parentNode.nextSibling.style.display == ""){
		Display = "none";
		if(document.getElementById(img))
			document.getElementById(img).src = "images/arrow_down_search.gif";
		ObjOpen.obj = null;
		ObjOpen.count = null;
		ObjOpen.img = null;
		ObjOpen.blockId = null;
	}
	else{
		Display = "";
		if (document.getElementById(img))
			document.getElementById(img).src = "images/arrow_left_search.gif";
		ObjOpen.obj = obj;
		ObjOpen.count = count;
		ObjOpen.img = img;
		ObjOpen.blockId = blockId;	
	}
		
	var currentTR = obj.parentNode
	for(var i=0;i < count;i++ )
	{
		//alert(currentTR.nextSibling.id.indexOf(blockId))
		if(currentTR.nextSibling){
			if (currentTR.nextSibling.id.indexOf(blockId)>-1){
				currentTR.nextSibling.style.display = Display
				if (Display == "none")
				{
					inputObj = currentTR.nextSibling.firstChild.nextSibling.firstChild
					switch(inputObj.nodeName)
					{
						case "SELECT":
							inputObj.selectedIndex=0;
						break;
							
						case "INPUT":
							inputObj.value="";
						break;
					}
				}
			}
			currentTR = currentTR.nextSibling
		}
	}
	}
}
									



function setFocus(strFocus){
	lastFocus = strFocus;
}

function showBasket()
	{
		
		//Generates the basket HTML
		var htmlString = "<table cellspacing=10 cellpadding=0><tr><td><div style='display:none;position:absolute;filter:Alpha(opacity=60)' id='pptMoveDiv'></div></td></tr>";
		var valuestring = ""
		var BasketObjectValueString = ""
		var QualityArray;
		var checked;
		
		for (var i=0; i < BasketArray.length ; i++)
		{										
			// QualityArray = eval('assetQualities'+BasketArray[i].assetid).split('¤') //set in codebehind
			
			QualityArray = BasketArray[i].assetqualities.split('$') //set in codebehind
													
			//	if (i%2==0)
					htmlString += '<tr>';	
				//for version 2.0 DONT DELETE THIS
				//htmlString += '<td ondblclick="deletePpt(this)" onclick="onclickPpt(this)" arrayIndex='+i+' onMouseMove="mouseMovePpt()" >'+BasketArray[i].innerHTML+'</td>';	
				
				if (BasketArray[i].assetTypeId == 5){						
					htmlString += "<td valign=top onclick=PreviewImage('"+ BasketArray[i].bigPreview +"')>"+BasketArray[i].innerHTML+'</td>';
				}else{
					htmlString += '<td valign=top>'+BasketArray[i].innerHTML+'</td>';
				}
				
				htmlString += "<td valign=top><table cellspacing=0 cellpadding=0 class=assetbottom border=0 >"
				for(var x = 1; x < QualityArray.length;x++)    
				{							
					if (QualityArray[x].split('@')[0] == BasketArray[i].outputName)
						checked = "Checked"
					else	
						checked = ""
					htmlString += "<tr><td><input onclick=\"setQuality(this,"+i+")\" "+checked+" type=radio name=\"Assetradio"+BasketArray[i].assetid+"\" value=\""+QualityArray[x].split('@')[0]+"\"></td><td align=left>"+QualityArray[x].split('@')[1]+"</td></tr>"	
				}						
				htmlString += "</table></td>";
					
			//	if (i%2==1)
					htmlString += '</tr>';	
				//valuestring += "#"+BasketArray[i].assetid +","+BasketArray[i].locationstring	
				if (valuestring.length > 0)
					valuestring += "#"+BasketArray[i].assetid+','+BasketArray[i].outputName 	
				else
					valuestring += BasketArray[i].assetid+','+BasketArray[i].outputName 	
				
				if(BasketObjectValueString != "")
					BasketObjectValueString += "#";
				BasketObjectValueString += BasketArray[i].assetid +","+ BasketArray[i].assetTypeId +","+ BasketArray[i].preview +","+ BasketArray[i].name +",'',"+ BasketArray[i].outputName + "," + BasketArray[i].assetqualities
		}
		document.getElementById('workarea').innerHTML = htmlString+'</table>'
		document.getElementById(assetArray_ClientID).value = valuestring;
		document.getElementById(assetArrayInfo_ClientID).value = BasketObjectValueString
		document.getElementById('headlineCollector').innerHTML = "ASSET CHOSEN FOR DOWNLOAD";
		
		if (BasketArray.length > 0)
		{
			document.getElementById('sendPpEmail').style.display='';
			document.getElementById('workarea').style.display='';
			document.getElementById('FotoCollector').style.display='';
		}
		/*else	
			document.getElementById('sendPpEmail').style.display='none';
			*/
	}
	
function clearBasket(){
	BasketArray = new Array()
	document.getElementById('errorEmailText').innerHTML = "";
	document.getElementById('workarea').innerHTML = "";
	document.getElementById('FotoCollector').style.display='none';								
	document.getElementById(assetArray_ClientID).value = "";
	document.getElementById(assetArrayInfo_ClientID).value = "";		
}

function setQuality(obj,basketIndex)
{				
	
	//alert(obj.value);
	BasketArray[basketIndex].outputName = obj.value;
	
	var stringAssetArrayinfo = document.getElementById(assetArrayInfo_ClientID).value.split('#')
	var AssetArraystr = document.getElementById(assetArray_ClientID).value.split(',')
	
	var currAssetArray
	for(var i=0 ; i < stringAssetArrayinfo.length ; i++) 
	{
		currAssetArray = stringAssetArrayinfo[i].split(',');
		if (currAssetArray[5].indexOf(obj.value.split('_')[0]) > -1)
		{	
			currAssetArray[5] = obj.value;
			stringAssetArrayinfo[i] = currAssetArray.join(',');
		}					
		
	}				
	
	for(var i=0 ; i < AssetArraystr.length ; i++) 
	{
		
		if (AssetArraystr[i].indexOf(obj.value.split('_')[0]) > -1 )
		{	
			if (AssetArraystr[i].indexOf('#') > -1)
			{
				AssetArraystr[i] = obj.value + '#' + AssetArraystr[i].split('#')[1]
				i = AssetArraystr.length
			}
			else
			{
				AssetArraystr[i] = obj.value
				i = AssetArraystr.length
			}
		}
	}
	
	
	document.getElementById(assetArray_ClientID).value = AssetArraystr.join(',')
	document.getElementById(assetArrayInfo_ClientID).value = stringAssetArrayinfo.join('#')				

}
function createBasket()
{				
	//Recreating the basketarray (EX. after new search)
	var temparray = document.getElementById(assetArrayInfo_ClientID).value.split('#')
	var baketInfoArray;
	var resultObj;
	var tempHTML="";
	
	//if(document.getElementById('<%=assetArrayInfo.ClientID%>')!=null)
	//	qew=1
	
	
	if (document.getElementById(assetArrayInfo_ClientID).value != "")
	{
		//alert(document.getElementById('<%=assetArrayInfo.ClientID%>').value);
		
		for (var i=0; i < temparray.length; i++ )
		{						
			
			baketInfoArray = temparray[i].split(',')						
		//	if (document.getElementById('assetQualities'+baketInfoArray[0])){
				//alert(baketInfoArray[0]);						
				tempHTML = createPptAsset(baketInfoArray[0],baketInfoArray[1], baketInfoArray[2], baketInfoArray[3])
				resultObj = new pptObject(baketInfoArray[0],baketInfoArray[1],baketInfoArray[2],baketInfoArray[3],tempHTML,baketInfoArray[4],baketInfoArray[5],baketInfoArray[6])
				BasketArray[i] = resultObj
		//	}
		}					
		showBasket();
	}
}
	
		var lockEnterKey = false;
		var lastFocus = "";		
		function kH(e) 
{
	var pK = document.all? window.event.keyCode:e.which;

	if (pK==13)
	{	
		
			if (lastFocus == "login")
			{
				lastFocus = "";
				document.getElementById(buttonLogon_ClientID).click();	
			}
			else
			{
				document.getElementById(button1_ClientID).click();
			}
		
																											
		event.returnValue = false;
		event.cancel = true;								
	}							
}

function closeConfirmSend(){
	if (document.getElementById('confirm')){document.getElementById('confirm').style.display='none';}
}

					
