function OpenProductContact()
{
	//Produkt anhand der URL ausfindig machen
	
	strLocation = document.location.toString();

	strLocation = strLocation.substring(1, strLocation.length -1);
	
	nReadPosition = strLocation.lastIndexOf("_read-");
	nProductId = strLocation.substring(nReadPosition+6, strLocation.length);
	
	strLocation = document.location.toString();
	
	strLocation = strLocation.substring(0, strLocation.lastIndexOf("DesktopDefault.aspx"));
	strLocation = strLocation + "DesktopDefault.aspx/tabid-21/product-" + nProductId + "/";

	document.location = strLocation;
}

function OpenProductContactWithId(nTabId, nContactId, nCallerTabId)
{
	//Produkt anhand der URL ausfindig machen
	
	strLocation = document.location.toString();

	strLocation = strLocation.substring(1, strLocation.length -1);
	
	nReadPosition = strLocation.lastIndexOf("_read-");
	nProductId = strLocation.substring(nReadPosition+6, strLocation.length);
	
	strLocation = document.location.toString();
	
	if( strLocation.lastIndexOf("DesktopDefault.aspx") == -1)
	{
		strLocation = strLocation.substring(0, strLocation.lastIndexOf(".aspx")-14);
		
	}
	else
	{
		strLocation = strLocation.substring(0, strLocation.lastIndexOf("DesktopDefault.aspx"));
	}
	
	strLocation = strLocation + "DesktopDefault.aspx/tabid-" + nTabId + "/product-" + nProductId + "/productcid-" + nContactId + "/callertabid-" + nCallerTabId + "/";

	document.location = strLocation;
}

function OpenJobContact()
{
	//Produkt anhand der URL ausfindig machen
	
	strLocation = document.location.toString();

	strLocation = strLocation.substring(1, strLocation.length -1);
	
	nReadPosition = strLocation.lastIndexOf("_read-");
	nJobId = strLocation.substring(nReadPosition+6, strLocation.length);
	
	strLocation = document.location.toString();
	
	strLocation = strLocation.substring(0, strLocation.lastIndexOf("DesktopDefault.aspx"));
	strLocation = strLocation + "DesktopDefault.aspx/tabid-21/jobid-" + nJobId + "/";

	document.location = strLocation;
}

function MoveSelectedToOther(lstObjFrom, lstObjTo)
{
	arrTmp = new Array();

	lstObjFrom = document.forms[0][lstObjFrom];
	lstObjTo = document.forms[0][lstObjTo];
	for(nCount = 0; nCount < lstObjFrom.options.length; nCount++)
	{

		if(lstObjFrom.options[nCount].selected == true)
		{
			o = new Option(lstObjFrom.options[nCount].text,lstObjFrom.options[nCount].value);
			lstObjTo.options[lstObjTo.options.length] = o;
		}	
		else
		{
			arrTmp[arrTmp.length] = lstObjFrom.options[nCount];
		
		}
	}
	
	lstObjFrom.options.length = 0;
	
	for(nCount = 0; nCount < arrTmp.length; nCount++)
	{
		lstObjFrom.options[nCount] = arrTmp[nCount];
	}
}

function AddProduct()
{

	MoveSelectedToOther(m_oObjects[0], m_oObjects[1]);
}

function RemoveProduct()
{
	MoveSelectedToOther(m_oObjects[1], m_oObjects[0]);
}

function ClickProductCheckBox(objectReference)
{
	objHiddenText = document.getElementById("unchecked_products");
	
	if(objectReference && objHiddenText)
	{
	
		arrValue = objHiddenText.value.split(";");
		strNewValue = "";
		
		for(nCount = 0; nCount < arrValue.length; nCount++)
		{
			if(arrValue[nCount] != objectReference.id && arrValue[nCount] != "")
			{
				strNewValue = strNewValue + arrValue[nCount] + ";"
			}
		
		}

		//
		if(!objectReference.checked)
		{
		
			strNewValue = strNewValue + objectReference.id + ";"
			
		}
		
		objHiddenText.value = strNewValue;
		
	}
}

function ChangeGroup(nGroupId, strButton)
{
	//Es wird gespeichert
	objHiddenText = document.getElementById("selected_group_id");
	
	if(objHiddenText)
	{
		objHiddenText.value = nGroupId;
	}
	strButton = ReplaceTagFromString(strButton, ":", "$");
	__doPostBack(strButton, '');
}
function CreateURLStringForGroupChange()
{
}


