function PopLink(Link){
popup = window.open(Link, "newwin1","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=300, height=300, left = 160, top = 90");
return;
}

function PopLink2(Link){
popup = window.open(Link, "schedule_details1","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=700, height=600, left=0, top=0");
return;
}

function PopLink3(Link){
popup = window.open(Link, "schedule_details2","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=620, height=400, left=0, top=0");
return;
}

function PopLink4(Link){
popup = window.open(Link, "schedule_details3","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=600, height=400, left=160, top=90");
return;
}

function PopLink5(Link){
popup = window.open(Link, "newwin2","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=200, height=200, left = 160, top = 90");
return;
}

function PopLink6(Link){
popup = window.open(Link, "newwin3","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=700, height=700, left = 80, top = 80");
return;
}



function PopChat(){
//var Link="http://www.crmbyweb.com/cgibin/chat/chat.cgi";
var Link="http://www.crmbyweb.com/crm/leave_message.htm";
popup = window.open(Link, "chat","toolbar=0, scrollbars=0, location=0, statusbars=0, menubar=no, resizable=1, width=400, height=500, left = 120, top = 00");
return;
}

function getCookie(name) {
  var cookies = document.cookie;
  var start = cookies.indexOf(name + '=');
  if (start == -1) return "";
  var len = start + name.length + 1;
  var end = cookies.indexOf(';',len);
  if (end == -1) end = cookies.length;
  return unescape(cookies.substring(len,end));
}



function PopChatAuto(){
//var Link="http://www.crmbyweb.com/cgibin/chat/chatauto.cgi";
var Link="http://www.crmbyweb.com/crm/leave_message_auto.htm";
var str=getCookie("chat");
if (str == "done")
	{
	return;
	}
document.cookie="chat=done; path=/;\n";
popup = window.open(Link, "chatauto","toolbar=0, scrollbars=1, location=0, statusbars=0, menubar=no, resizable=1, width=400, height=500, left = 120, top = 00");
return;
}

function PopLink7(Link){
popup_preview = window.open(Link, "preview","toolbar=0, scrollbars=0, location=0, statusbars=0, menubar=no, resizable=1, width=505, height=500, left = 120, top = 00");
//while(1)
//	{
//	if (!popup_preview.closed)
//		{
//		continue;
//		}
//	else
//		{
//		PopChatAuto();
//		break;
//		}
//	}
return;
}

function adjust_field(str)
{
var ret_str="";
for (var i=0; i<str.length; i++)
	{
	if (str.charAt(i)=="&")
		{
		ret_str+=" and ";
		}
	else if (str.charAt(i)=="=" || str.charAt(i)=="\"" || str.charAt(i)=="'" || str.charAt(i)=="%")
		{
		continue;
		}
	
	else
		{
		ret_str+=str.charAt(i);
		}
	}

return ret_str;
}

function get_diff(tm1, tm2)
{
var hr1=tm1.substring(0,2);
var min1=tm1.substring(3,5);
var hr2=tm2.substring(0,2);
var min2=tm2.substring(3,5);
if ((hr1/1==0 && min1/1==0) || (hr2/1==0 && min2/1==0))
	{
	return "N/A";
	}
var t1=hr1/1+min1/60;
var t2=hr2/1+min2/60;
var diff=t2-t1;
var ret_str=diff + " hr.";
return ret_str;
}


