var _SID;
var _NGID;
var _CID;
var _BID;
	var _SurveyID;
	var _SurveyREF;
	var cssCode = '.SurvTbHead{	border:solid 1px #07588F; background-color:#F0F0F0; color:#07588F; font-family:Verdana; font-size: 12pt;} ';
	cssCode += '.SurvTrHeadTitle{ background-color:#F0F0F0; color:#07588F; font-family:Verdana; font-size:12pt;} ';
	cssCode += '.SurvTrHeadDesc{ background-color:#F0F0F0; color:#333333; font-family:Verdana; font-size:10pt;} ';
	cssCode += '.SurvTbAskInfo{ border:solid 1px #07588F; background-color:#FFFFFF; color:#07588F; font-family:Verdana; font-size:10pt; font-weight:bold;} ';
	cssCode += '.SurvTdAskInfo{ background-color:#FFFFFF; color:#07588F;} ';
	cssCode += '.SurvInputAskInfo{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTbContainer{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTdContainer{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTbQuestion{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTdQuestionCont{ background-color:#FFFFFF; font-family:Verdana; font-size:10pt; font-weight:bold; color:#000000;} ';
	cssCode += '.SurvTrQuestionTitle{ background-color:#EEEEEE; color:#000000; font-family:Verdana; font-size:10pt;} ';
	cssCode += '.SurvTrAnswer{ border:solid 3px #A0A0A0; background-color:#FFFFFF; font-family:Verdana; font-size:10pt; padding: 8 8 8 8;} ';
	cssCode += '.SurvTbInAnswer{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputSel{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputCh{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputText{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputTextA{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputRadio{ background-color:#FFFFFF;} ';
	cssCode += '.SurvInputButton{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTbMsg{ border:solid 1px #07588F; background-color:#FFFFFF; color:#07588F; font-family:Verdana; font-size:11pt; font-weight:bold;} ';
	cssCode += '.SurvTrMsg{ background-color:#FFFFFF;} ';
	cssCode += '.SurvTbFooter{ border:solid 1px #C0C0C0; background-color:#FFFFFF; font-size:8pt;} ';
	cssCode += '.SurvTrFooter{ background-color:#EEEEEE; padding-top:0; padding-left:0; font-family:Verdana; color=#000000; font-size:7pt;} ';
	cssCode += '.SurvTbInvitation{ border:solid 1px #07588F; background-color:#FFFFFF; color:#07588F; font-family:Verdana; font-size:10pt; font-weight:bold;} ';
	cssCode += '.SurvTdInvitation{ background-color:#FFFFFF; color:#07588F;} ';

function _ShowNews(){
   document.writeln ("<div id=\"MyNewsFrame\"></div>");
   var url = "http://services.dotfront.com/news/shownews.asp?sid=" + _SID + "&ngid=" + _NGID;
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function _ShowBlogs(){
   document.writeln ("<div id=\"MyBlogsFrame\"></div>");
   var url = "http://services.dotfront.com/news/showblog.asp?sid=" + _SID + "&bid=" + _BID;
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

//	--- Add by F: ---
function _ShowSurveyScript(){
	var auxCad = '';
	document.writeln ("<div id=\"MySurveyScriptFrame\"></div>");
	if (_SurveyREF != ''){	auxCad = "&REF=" + _SurveyREF;}else{auxCad='';}
	var dtfurl = "http://services.dotfront.com/news/ShowSurveyScript.asp?SID=" + _SID + "&SurveyID=" + _SurveyID + auxCad;
	var headID = document.getElementsByTagName("head")[0];
	var newScript = document.createElement('script');
	newScript.type = 'text/javascript';
	newScript.src = dtfurl;
	newScript.id = "Base";
	headID.appendChild(newScript);
	
	var newStyleElement = document.createElement('style');
	newStyleElement.type = 'text/css';
	if (newStyleElement.styleSheet){			// for IE:
		newStyleElement.styleSheet.cssText = cssCode;
	}else{										// for other browsers:
		newStyleElement.appendChild(document.createTextNode(cssCode));
	}
	headID.appendChild(newStyleElement);
}
function Show_SurveyScript(root) {
	document.getElementById("MySurveyScriptFrame").innerHTML = root.Table;
}

function _ShowSurveyIntro(){
	document.writeln ("<div id=\"MySurveyIntroFrame\"></div>");
	var dtfurl = "http://services.dotfront.com/news/ShowSurveyIntro.asp?SID=" + _SID + "&SurveyID=" + _SurveyID;
	//var dtfurl = "http://dotlp.dotfront.net:83/services/newspublicator/news/ShowSurveyIntro.asp?SID=" + _SID + "&SurveyID=" + _SurveyID;
	var headID = document.getElementsByTagName("head")[0];
	var newScript = document.createElement('script');
	newScript.type = 'text/javascript';
	newScript.src = dtfurl;
	newScript.id = "Base";
	headID.appendChild(newScript);
	
	var newStyleElement = document.createElement('style');
	newStyleElement.type = 'text/css';
	if (newStyleElement.styleSheet){			// for IE:
		newStyleElement.styleSheet.cssText = cssCode;
	}else{										// for other browsers:
		newStyleElement.appendChild(document.createTextNode(cssCode));
	}
	headID.appendChild(newStyleElement);
}
function Show_SurveyIntro(root) {
	document.getElementById("MySurveyIntroFrame").innerHTML = root.Table;
}
function _ShowSurvey(){
	window.open("http://services.dotfront.com/news/ShowSurvey.asp?SID=" + _SID + "&SurveyID=" + _SurveyID,"ShowSurvey","menubar=1,scrollbars=1,resizable=0,status=0,width=615,height=500");
}
function CheckDTFsurvey(frm){
	var iCont = frm.dtf_Cont.value;
	var xTarget = frm.dtfTarget.value;
	var iType = "";
	var iDM = "";	//Display Mode
	var iValue = "";
	var sw = 1;
	var sw2 = 1
	var item = "";
	var itemNum = 0;
	var jj = 1;
	var aux = 0;
	if (frm.dtfSaveI.value == 'True'){
		if (!frm.dtfName.value){
			sw2 = 0; alert ("Please fill your NAME"); frm.dtfName.focus();
		}else{
			if (!frm.dtfEmail.value){
				sw2 = 0; alert ("Please fill your E-mail"); frm.dtfEmail.focus();
			}else{
				if (!isEmail(frm.dtfEmail.value)){
					cad = "Please fill correctly your E-mail\n";
					cad+= "No spaces nor special characters."
					sw2 = 0; alert (cad); frm.dtfEmail.focus();
				}
			}
		}
	}
	if (sw2 == 1){
		while (jj <= iCont && sw == 1){
			auxIsReq = document.all('dtfIR_' + jj).value;
			if (auxIsReq == 1){
				iType = document.all('dtfTYPE_' + jj).value;
				iDM = document.all('dtfDM_' + jj).value;
				switch (iType){
					case "1":
						if (iDM == 1 || iDM == 2){
							aux = document.all('dtfR_' + jj).length;
							sw = 0;
							for (kk=0; kk<aux; kk++){
								if (document.all('dtfR_' + jj)[kk].checked){sw = 1;}
							}
							if (sw == 0){item = 'dtfR_' + jj; itemNum = jj;}
						}
						if (iDM == 3){
							var auxSel = document.all('dtfSEL_' + jj).selectedIndex;
							if (auxSel <= 0){	sw = 0;	item = 'dtfSEL_' + jj; itemNum = jj;}
						}
						break;
					case "2":
						if (iDM == 1 || iDM == 2){
							aux = document.all('dtfCH_' + jj).length;
							sw = 0;
							for (kk=0; kk<aux; kk++){
								if (document.all('dtfCH_' + jj)[kk].checked){sw = 1;}
							}
							if (sw == 0){item = "dtfCH_" + jj; itemNum = jj;}
						}
						if (iDM == 3){
							var auxSel = document.all('dtfSEL_' + jj).selectedIndex;
							if (auxSel <= 0){	sw = 0;	item = 'dtfSEL_' + jj; itemNum = jj;}
						}
						break;
					case "3":
						iValue = document.all('dtf_' + jj).value;
						if (iValue == ''){	sw = 0;	item = 'dtf_' + jj; itemNum = jj;}
						break;
				}
			}
			if (sw == 1){	jj++;}
		}
		if (sw == 1){
			if (xTarget != ""){OpenPopupMsg();}
			frm.submit();
		}else{
			alert ("Please answer question number " + itemNum);
			if (iType == 3){document.all(item).focus();}
			else{document.all(item)[0].focus();}
		}
	}
}
function OpenPopupMsg(){
	window.open("http://services.dotfront.com/news/ShowSurveyPopupMsg.asp?dtfMsg=1","ShowSurveyMsg","menubar=1,scrollbars=0,resizable=0,status=0,width=615,height=400");
}
function isEmail(sValue){
	var isOK = true;
	var iLength = sValue.length;
	var iArr = 0;
	var iDot = 0;
	if (iLength < 6){
		isOK = false;
		return isOK;
	}
	for (j=0; j<iLength; j++){
		if(	(sValue.substring(j,j+1) == " ") ||
			(sValue.substring(j,j+1) == "'") ||
			(sValue.substring(j,j+1) == "*") ||
			(sValue.substring(j,j+1) == "%") ||
			(sValue.substring(j,j+1) == ",") ||
			(sValue.substring(j,j+1) == "&") ||
			(sValue.substring(j,j+1) == "/") ||
			(sValue.substring(j,j+1) == "$") ||
			(sValue.substring(j,j+1) == "=") ||
			(sValue.substring(j,j+1) == "#") ||
			(sValue.substring(j,j+1) == "?") ||
			(sValue.substring(j,j+1) == "¿") ||
			(sValue.substring(j,j+1) == "<") ||
			(sValue.substring(j,j+1) == ">") ||
			(sValue.substring(j,j+1) == "\""))	{      isOK = false;
		}
		if (sValue.substring(j,j+1) == "@") iArr += 1;
		if (sValue.substring(j,j+1) == ".") iDot += 1;
	}
	if (iArr != 1) isOK = false;
	if (iDot < 1) isOK = false;
	return isOK;
}
//	--- End ---------

function _ReLoadBlog(){
   var url = "http://services.dotfront.com/news/showblog.asp?sid=" + _SID + "&bid=" + _BID;
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function _ShowPost(iPostID){
   document.getElementById("MyBlogsFrame").innerHTML = "Loading...";
   var url3 = "http://services.dotfront.com/news/showblog.asp?sid=" + _SID + "&bid=" + _BID + "&pid=" + iPostID + "&type=post";
   var headID3 = document.getElementsByTagName("head")[0];
   var newScript3 = document.createElement('script');
   newScript3.type = 'text/javascript';
   newScript3.src = url3;  
   newScript3.id = "Base";
   headID3.appendChild(newScript3);
}

function _ShowTag(iTagID){
   document.getElementById("MyBlogsFrame").innerHTML = "Loading...";
   var url = "http://services.dotfront.com/news/showblog.asp?sid=" + _SID + "&bid=" + _BID + "&tid=" + iTagID + "&type=tag";
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function _ShowMonth(iMonth,iYear){
   document.getElementById("MyBlogsFrame").innerHTML = "Loading...";
   var url = "http://services.dotfront.com/news/showblog.asp?sid=" + _SID + "&bid=" + _BID + "&m=" + iMonth + "&y=" + iYear + "&type=month";
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function _ShowContent(){
   document.writeln ("<div id=\"MyContentFrame\"></div>");
   var url = "http://services.dotfront.com/news/showcontents.asp?sid=" + _SID + "&cid=" + _CID;
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function Show_News(root) {
  document.getElementById("MyNewsFrame").innerHTML = root.Table;
}

function Show_Contents(root) {
  document.getElementById("MyContentFrame").innerHTML = root.Table;
}

function Show_Blogs(root) {
  document.getElementById("MyBlogsFrame").innerHTML = root.Table;
}

function _ShowNewsDetail(iNotID){
  document.getElementById("MyNewsFrame").innerHTML = "Loading...";
  var url2 = 'http://services.dotfront.com/news/ShowNewsDetail.asp?sid=' + _SID + '&ngid=' + _NGID + '&nid=' + iNotID;
  var headID2 = document.getElementsByTagName("head")[0];
  var newScript2 = document.createElement('script');
  newScript2.type = 'text/javascript';
  newScript2.src = url2;  
  headID2.appendChild(newScript2);
}

function Show_NewsDetail(root){
  document.getElementById("MyNewsFrame").innerHTML = root.News;
}

function _ReLoadNews(){
   var url = "http://services.dotfront.com/news/ShowNews.asp?sid=" + _SID + "&ngid=" + _NGID;
   var headID = document.getElementsByTagName("head")[0];
   var newScript = document.createElement('script');
   newScript.type = 'text/javascript';
   newScript.src = url;  
   newScript.id = "Base";
   headID.appendChild(newScript);
}

function _CommentIt(iPostID){
  window.open("http://services.dotfront.com/news/makecomment.asp?sid=" + _SID + "&bid=" + _BID + "&pid=" + iPostID,"MakeComment","menubar=1,scrollbars=0,resizable=0,width=500,height=280");
}
