<!--

///////////////////////////////////////////
// Script loading - dont modify this part. 
//                  It has functions that
//                  allow the caller to 
//                  load Webphone code into
//                  a webpage
///////////////////////////////////////////////
function addServerScript(doc, scriptname){
	var config = new Array();
	setCustomSoftphoneConfig(config);
	
	addScript(doc, scriptname, config.sphPath);
}

function addScript(doc, scriptname, serverPath){
	/*var headTag;
	
	if(doc.getElementsByTagName){
		var ele = doc.getElementsByTagName("head");
		headTag = ele[0];
	}else{
		if(doc.head){
			headTag = doc.head;
		}
	}
	
	if(headTag){
		var newscript = doc.createElement("script");
		newscript.language = "javascript";
		newscript.type = "text/javascript";
		newscript.src = serverPath+"/"+scriptname;
		
		headTag.appendChild(newscript);
	}*/
	
	doc.write( '<scr'+'ipt language="javascript" type="text/javascript" src="'+serverPath+'/'+scriptname+'"></scr'+'ipt>');
}

function addServerStyleSheet(doc, stylesheetname){
	var config = new Array();
	setCustomSoftphoneConfig(config);
	
	addStyleSheet(doc, stylesheetname, config.sphPath+"/defaultstyles");
}

function addStyleSheet(doc, stylesheetname, serverPath){
	doc.write( '<li'+'nk rel="stylesheet" type="text/css" media="screen" href="'+serverPath+'/'+stylesheetname+'"></li'+'nk>');
}

function loadLoginFiles(doc){
	var doc = window.document;
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "createuser.js");
	addServerScript(doc, "startup.js");
	//addServerScript(doc, "remoteScripting.js");
	addServerScript(doc, "constructSoftphone.js");
}

function loadCreateUserFiles(doc){
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "createuser.js");
	addServerScript(doc, "remoteScripting.js");
	addServerScript(doc, "startup.js");
}

function loadStartUpFiles(doc){
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "constructSoftphone.js");
	
	addServerStyleSheet(doc, "softphone.css");
	
	try{

		var stylestr = getSoftphoneStyles(); //getCustomSoftphoneStyles();
	
		if(stylestr != null){
			var 	HTMLstring ='<STYLE type="text/css">\n';
				HTMLstring+='<!--\n';
				HTMLstring+= stylestr+'\n';
				HTMLstring+='-->\n';
				HTMLstring+='</STYLE>\n';
			doc.write(HTMLstring);
		}
	} catch(e) {}
}


function loadSearchFiles(doc){
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "remoteScripting.js");
	addServerScript(doc, "searchfunctions.js");

	addServerStyleSheet(doc, "softphone.css");

	try{
		var stylestr = getSoftphoneStyles(); //getCustomSoftphoneStyles();
	
		if(stylestr != null){
			var 	HTMLstring ='<STYLE type="text/css">\n';
				HTMLstring+='<!--\n';
				HTMLstring+= stylestr+'\n';
				HTMLstring+='-->\n';
				HTMLstring+='</STYLE>\n';
			doc.write(HTMLstring);
		}
	} catch(e){}
}

function loadRechargeFiles(doc){
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "rechargefunctions.js");
	
	addServerStyleSheet(doc, "softphone.css");
	
	try {
		var stylestr = getSoftphoneStyles(); //getCustomSoftphoneStyles();
	
		if(stylestr != null){
			var 	HTMLstring ='<STYLE type="text/css">\n';
				HTMLstring+='<!--\n';
				HTMLstring+= stylestr+'\n';
				HTMLstring+='-->\n';
				HTMLstring+='</STYLE>\n';
			doc.write(HTMLstring);
		}
	} catch(e) {}
}

function loadAccountFiles(doc){
	addServerScript(doc, "defaultconfig.js");
	addServerScript(doc, "cust.js");
}

function setStyles(sphStyles)
{
	// customer information contained in sphStyles.xyz

	// webphone window
	var styles = ".webphonePanel{background: "+sphStyles.GeneralColorBgPanel+";color:"+sphStyles.GeneralColorText+";}";

	// main panel
	styles += ".mainPanel{background: "+sphStyles.MainColorBgPanel+";color:"+sphStyles.MainColorText+";}";
	
	// title panel
	styles += ".titlePanel{background: "+sphStyles.TitleColorBgPanel+";color:"+sphStyles.TitleColorText+";}";

	// The tab colors
	styles += "div#tabdiv a{background:"+sphStyles.MainColorBgTabNotSelected+";color:"+sphStyles.MainColorTabNotselected+";border: solid 1px "+sphStyles.colorBord+";}";
	styles += "div#tabdiv a:active, div#tabdiv a:hover{background: "+sphStyles.MainColorBgTabOnMouseOver+";color:"+sphStyles.MainColorTabOnMouseOver+";border: solid 1px "+sphStyles.colorBord+";border-bottom: solid 3px "+sphStyles.colorGen+";}";
	styles += "div#tabdiv a.selectedtab, a.selectedtab:active{background: "+sphStyles.MainColorBgTabSelected+";color:"+sphStyles.MainColorTabSelected+";border: solid 1px "+sphStyles.colorBord+";border-bottom: solid 3px "+sphStyles.colorGen+";}";

	// Home Account Infos
	styles += ".homeAccountInfosPanel{background:"+sphStyles.HomeColorBgPanelAccountInfos+";color:"+sphStyles.HomeColorTextAccountInfos+";}";

	// Home Forward settings
	styles += ".homeForwardSettings{background:"+sphStyles.HomeColorBgPanelForwardSettings+";color:"+sphStyles.HomeColorTextForwardSettings+";}";


	styles += ".borderDark{border: "+sphStyles.colorBord+" solid 1px ;}";
	
	
	// You can put an image in back of the dialbuttons for example
	styles += ".numbutton{background: "+sphStyles.bgButton+";width:50px;height:30px;margin:0px;border:0px;color: "+sphStyles.colorButton+";}";

	return styles;	
}
-->