function redirectTo(str,type){
	if(type == "_blank"){
		window.open(str,type);
	}
	else{
		window.location = str;
	}
}

function showHideMenu(str, type){
	if(type == 's'){
		closeAll();
		document.getElementById(str).style.visibility = "visible";
		changeMe(str,'down');
	}
	else{
		document.getElementById(str).style.visibility = "hidden";
	}
}

function closeAll(){
	var arr = Array('marketing','sales','implementation','support','product');
	for(i=0;i<arr.length;i++){
		showHideMenu(arr[i], 'h');
		changeMe(arr[i],'up');
	}
}

function changeMe(str,type){
	document.getElementById(str+'_butt').style.background = "url(../images/"+str+"-btn_"+type+".jpg)";
}

function showHideManageInfo(strDiv,strDiv2){
	var arr = Array();
	arr['showLinkDiv'] = "showdetails";
	arr['editLinkDiv'] = "editdetails";
	
	document.getElementById(strDiv).style.display = "none";
	document.getElementById(arr[strDiv]).style.display = "block";

	document.getElementById(strDiv2).style.display = "block";
	document.getElementById(arr[strDiv2]).style.display = "none";
}

function showHideManageLogin(strDiv){
	var arr = Array('changePasswordDiv','editSalesCom','editMD');
	
	for(i=0;i<arr.length;i++){
		if(arr[i] != strDiv){
			document.getElementById(arr[i]).style.display = 'none';
		}
	}
	
	if(document.getElementById(strDiv).style.display == 'none'){
		document.getElementById(strDiv).style.display = 'block';
	}
	else{
		document.getElementById(strDiv).style.display = 'none'
	}
}

function checkStatus(){
	var retnode = [];
	var myclass = 'topcmmLiveStatusImg';
	var elem = document.getElementsByTagName('img');
	for (var i = 0; i < elem.length; i++) {
	var classes = elem[i].className;
	if(classes == myclass){
	retnode.push(elem[i]);
	}
	}
	
	if(retnode[0].src == "http://allscripts.ocean22portal.com/images/operator_offline.png"){
		popitup("send_sms.html");
	}
	else{
		window.location = "http://allscripts.ocean22portal.com/blog_logger.html?to=123flashchat.php";
	}
	
}

function popitup(url) {
	newwindow=window.open(url,'name','height=500,width=550');
	if (window.focus) {newwindow.focus()}
	return false;
}

