function onLoadFunction()
{
	// set focus on the first input in page (if exist)
	try {
		document.getElementsByTagName("INPUT")[0].focus();
	}
	catch(e){} 
}

function f_showMsg(as_msg,al_icon,as_title)  {
	//var ll_rc=window.showModalDialog("msgWin.asp?msg=" + as_msg + "&icon=" + al_icon +"&title=" + as_title,"","dialogHeight:150px;dialogWidth:330px;help:no;resizable:no;status:no;scroll:no;")
	//return ll_rc;
	alert(as_msg);
}

// confirming the delete action does not invoke a delete action,
// it sends relevant information in the querystring,
// and the decision whether to use this info or not is taken in the server side 
function confirmDelete(msg,deletePostingGuid){
	if (confirm(msg)){
		var curUrl = document.location.href;
		curUrl += "&deletePostingGuid="+deletePostingGuid;
		document.location.href=curUrl;
	}
	else return false;
}
function confirmChannelDelete(msg,deleteChanelGuid){
	if (confirm(msg)){
		var curUrl = document.location.href;
		curUrl += "&deleteChannelGuid="+deleteChanelGuid;
		document.location.href=curUrl;
	}
	else return false;
}
// confirming the delete action does not invoke a delete action,
// it sends relevant information in the querystring,
// and the decision whether to use this info or not is taken in the server side 
function confirmHTMLPlaceHolderDelete(msg,deleteHTMLPlaceholderGuid,id){
	if (confirm(msg)){
		var curUrl = document.location.href;
		curUrl += "&deleteHTMLPlaceholderGuid="+deleteHTMLPlaceholderGuid+"&PlaceHolderDefenitionID="+id;
		document.location.href=curUrl;
	}
	else return false;
}

function onLoadFunction()
{
	// set focus on the first input in page (if exist)
	var inputCollection = document.getElementsByTagName("INPUT");
	var i = 0;
	var stop = false;
	
	while (!stop && i<inputCollection.length)
	{
		if (inputCollection[i].type == "text")
		{
			inputCollection[i].focus();
			stop = true;
		}
		i++
	}
}

function checkEmpty()
{
	var str = document.getElementById("SearchInput").value;
	if (str == null || str == "")
	{
		return false;
	}
	else
	{
		return true;
	}
}

function TopNavOver(id)
{
	var img = document.getElementById('AddwiseHeader1_Header1_TopNavigation1_' + id);
	if(img != null) img.src = img.src.replace(".gif","_on.gif");
	else{
		img = document.getElementById('AddwiseHeader1_Header1_TopNavigationEng1_' + id);
		if(img != null) img.src = img.src.replace(".gif","_on.gif");
	}
} 

function TopNavOut(id)
{
	var img = document.getElementById('AddwiseHeader1_Header1_TopNavigation1_' + id);
	if(img != null) img.src = img.src.replace("_on.gif",".gif");
	else{
		img = document.getElementById('AddwiseHeader1_Header1_TopNavigationEng1_' + id);
		if(img != null) img.src = img.src.replace("_on.gif",".gif");
	}
}

function TopNavOverAr(id)
{
	var img = document.getElementById('AddwiseHeader1_Header1_TopNavigation1_' + id);
	if(img != null) img.src = img.src.replace(".gif","_on.gif");
	else{
		img = document.getElementById('AddwiseHeader1_Header1_TopnavigationAr1_' + id);
		if(img != null) img.src = img.src.replace(".gif","_on.gif");
	}
} 

function TopNavOutAr(id)
{
	var img = document.getElementById('AddwiseHeader1_Header1_TopNavigation1_' + id);
	if(img != null) img.src = img.src.replace("_on.gif",".gif");
	else{
		img = document.getElementById('AddwiseHeader1_Header1_TopnavigationAr1_' + id);
		if(img != null) img.src = img.src.replace("_on.gif",".gif");
	}
}

function resetForm()
{
	document.forms[0].reset();
	var obj = document.getElementsByTagName("input");			
	for (i = 0 ; i < obj.length ; i++)
	{
		if((obj[i].type == "text"))
		{
			obj[i].value = "";
		}
	}
}

//open a new window
//newUrl - This is the web address of the page you wish to appear in the new window. 
function openWin(newUrl, name, options)
{ 
	window.open(newUrl, name, options);
}

