english_image1 = new Image
english_image2 = new Image
english_image1.src = '/img/english.gif';
english_image2.src = '/img/english_over.gif';

hindi_image1 = new Image
hindi_image2 = new Image
hindi_image1.src = '/img/hindi.gif';
hindi_image2.src = '/img/hindi_over.gif';

var my_base_url='http://malayalam.yuyam.com';
var my_yuyam_base='';
var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
  try {
  xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
 } catch (e) {
  try {
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  } catch (E) {
   xmlhttp=false
  }
 }
@else
 xmlhttp=false
@end @*/

if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
{
  try {
	xmlhttp = new XMLHttpRequest ();
  }
  catch (e) {
  xmlhttp = false}
}

function myXMLHttpRequest ()
{
  var xmlhttplocal;
  try {
  	xmlhttplocal = new ActiveXObject ("Msxml2.XMLHTTP")}
  catch (e) {
	try {
	xmlhttplocal = new ActiveXObject ("Microsoft.XMLHTTP")}
	catch (E) {
	  xmlhttplocal = false;
	}
  }

  if (!xmlhttplocal && typeof XMLHttpRequest != 'undefined') {
	try {
	  var xmlhttplocal = new XMLHttpRequest ();
	}
	catch (e) {
	  var xmlhttplocal = false;
	}
  }
  return (xmlhttplocal);
}

var mnmxmlhttp = Array ();
var mnmString = Array ();
var mnmPrevColor = Array ();
var responsestring = Array ();
var myxmlhttp = Array ();
var responseString = new String;


function giveYourVote (user, id, htmlid, md5, value)
{
  	if (xmlhttp) {
		url = "/giveYourVote.php";
		var content = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = true;
        if (anonymous_vote == false && user == '0') {
            window.location="http://malayalam.yuyam.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');

    			mnmxmlhttp[htmlid].send (content);
    			errormatch = new RegExp ("^ERROR:");

    			target1 = document.getElementById ('mnms-' + htmlid);

    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			//target1.style.background = '#c00';
    			//target1.style.backgroundColor = '#FF9D9F';
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (mnmString[htmlid].match (errormatch)) {
    						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
    						changemnmvalues (htmlid, true);    					} else {
    						changemnmvalues (htmlid, false);    					}
    				}
    			}
    		}
    	}
	}
}

function cvote (user, id, htmlid, md5, value)
{
	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/cvote.php";
		content = "id=" + id + "&user=" + user + "&md5=" + md5 + "&value=" + value;
		anonymous_vote = false;

        if (anonymous_vote == false && user == '0') {
            window.location="http://malayalam.yuyam.com/login.php?return="+location.href;
        } else {
    		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
    		if (mnmxmlhttp) {
    			mnmxmlhttp[htmlid].open ("POST", url, true);
    			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
    					   'application/x-www-form-urlencoded');

    			mnmxmlhttp[htmlid].send (content);
    			errormatch = new RegExp ("^ERROR:");
    			target1 = document.getElementById ('cvote-' + htmlid);

    			mnmPrevColor[htmlid] = target1.style.backgroundColor;
    			//target1.style.background = '#c00';
    			target1.style.backgroundColor = '#FFFFFF';
    			mnmxmlhttp[htmlid].onreadystatechange = function () {
    				if (mnmxmlhttp[htmlid].readyState == 4) {
    					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;
    					if (mnmString[htmlid].match (errormatch)) {
    						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);
    						// myclearTimeout(row);
    						// resetrowfull(row);

    						changecvotevalues (htmlid, true);

    					} else {
							target1 = document.getElementById ('ratebuttons-' + id);
							target1.style.display = "none";

							target2 = document.getElementById ('ratetext-' + id);
							target2.innerHTML = "Thank you for rating this comment.";

							changecvotevalues (htmlid, false);
    					}
    				}
    			}
    		}
    	}
	}
}

function changemnmvalues (id, error)
{
	split = new RegExp ("~--~");
	b = mnmString[id].split (split);
	//alert(id);
	target1 = document.getElementById ('mnms-' + id);
	target2 = document.getElementById ('mnmlink-' + id);
	if (error) {
		target2.innerHTML = "<span>Already voted</span> ";
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
		target2.innerHTML = "<span>Already voted</span> ";
	}
	return false;
}

function changecvotevalues (id, error)
{
	split = new RegExp ("~--~");
	b = mnmString[id].split (split);
	//alert(id);
	target1 = document.getElementById ('cvote-' + id);
	//target2 = document.getElementById ('mnmlink-' + id);
	if (error) {
	//	target2.innerHTML = "<span>vote cast</span>";
		return false;
	}
	if (b.length <= 3) {
		target1.innerHTML = b[0];
		target1.style.backgroundColor = mnmPrevColor[id];
	//	target2.innerHTML = "<span>vote cast</span>";
	}
	return false;
}


function enablebutton (button, button2, target)
{
	var string = target.value;
	button2.disabled = false;
	if (string.length > 0) {
		button.disabled = false;
	} else {
		button.disabled = true;
	}
}

function checkfield (type, form, field)
{
	url = 'http://malayalam.yuyam.com/checkfield.php?type='+type+'&name=' + encodeURIComponent(field.value);
	checkitxmlhttp = new myXMLHttpRequest ();
	checkitxmlhttp.open ("GET", url, true);
	checkitxmlhttp.onreadystatechange = function () {
		if (checkitxmlhttp.readyState == 4) {
		responsestring = checkitxmlhttp.responseText;
			if (responsestring == 'OK') {
				document.getElementById (type+'checkitvalue').innerHTML = '<span style="color:black">"' + field.value +
						'": ' + responsestring + '</span>';
				form.submit.disabled = '';
			} else {
				document.getElementById (type+'checkitvalue').innerHTML = '<span style="color:red">"' + field.value + '": ' +
				responsestring + '</span>';
				form.submit.disabled = 'disabled';
			}
		}
	}
  //  xmlhttp.setRequestHeader('Accept','message/x-formresult');
  checkitxmlhttp.send (null);
  return false;
}

function report_problem(frm, user, id, md5 /*id, code*/) {
	if (frm.ratings.value == 0)
		return;
	if (! confirm("do you wish to report the problem?") ) {
		frm.ratings.selectedIndex=0;
		return false;
	}
	content = "id=" + id + "&user=" + user + "&md5=" + md5 + '&value=' +frm.ratings.value;
	url="http://malayalam.yuyam.com/problem.php?" + content;
	xmlhttp.open("GET",url,true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			frm.ratings.disabled=true;
			alert(xmlhttp.responseText);
		}
  	}
	xmlhttp.send(null);
	return false;
}

function emailto (original_id, htmlid, instpath, address_count)
{
	email_message = document.getElementById('email_message' + htmlid).value;

	email_address = document.getElementById('email_address_1_' + htmlid).value;
	if (address_count > 1){
		for ($i = 2; $i <= address_count; $i++) {
			if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
				email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
			}
		}
	}

	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/recommend.php";
		content = "email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Sending, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('emailto-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}

function show_recommend(user,htmlid, linkid, instpath)
{
  if (user == '0') {

	if (window.event) {

           window.event.returnValue = false;
           window.event.cancelBubble = true;//stop the event being passed to higher level
	}
            window.location="http://malayalam.yuyam.com/login.php?return="+location.href;
	//window.location.href.assign("http://malayalam.yuyam.com/login.php?return="+location.href) ;
            return;
         }
	var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
	document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;



	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/recommend.php";
		content = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('emailto-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var memoryduration="7" //persistence in # of days

var contractsymbol='templates/mollio-beat/images/minus.gif' //Path to image to represent contract state.
var expandsymbol='templates/mollio-beat/images/plus.gif' //Path to image to represent expand state.

/////No need to edit beyond here //////////////////////////

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}


function expandcontent(curobj, cid){
if (ccollect.length>0){
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
curobj.src=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].src=expandsymbol
else
statecollect[inc].src=contractsymbol
inc++
}
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="none")
selectedItem+=ccollect[inc].id+"|"
inc++
}
if (get_cookie(window.location.pathname)!=selectedItem){ //only update cookie if current states differ from cookie's
var expireDate = new Date()
expireDate.setDate(expireDate.getDate()+parseInt(memoryduration))
document.cookie = window.location.pathname+"="+selectedItem+";path=/;expires=" + expireDate.toGMTString()
}
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0)
revivecontent()
if (ccollect.length>0 && statecollect.length>0)
revivestatus()
}

if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate


function submitForm11(thisButton){
var rForm= thisButton.form;
//rForm.language_name.value=rForm.language_id.options[rForm.language_id.selectedIndex].text;

rForm.submit();
return false;


}

function openTitleTransliterationWindow(seq) {

var rawText;
var transText;
if (seq==1) {
document.getElementById("tagTransliterate").style.visibility="hidden";
document.getElementById("bodyTransliterate").style.visibility="hidden";
rawText=document.getElementById("rawtitle");
transText=document.getElementById("title");

document.getElementById("titleTransliterate").style.left="300px";
document.getElementById("titleTransliterate").style.top="0px";
document.getElementById("titleTransliterate").style.visibility="visible";
transText.style.height="24px";
transText.style.font = '12pt serif';
transText.setAttribute('class',"loginTextboxstyleBigger");
transText.readOnly=true;
document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("titleTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > "; }
}
 }

if (seq==2) {
document.getElementById("titleTransliterate").style.visibility="hidden";
document.getElementById("bodyTransliterate").style.visibility="hidden";
rawText=document.getElementById("rawtag");
transText=document.getElementById("tags");

document.getElementById("tagTransliterate").style.left="300px";
document.getElementById("tagTransliterate").style.top="0px";
document.getElementById("tagTransliterate").style.visibility="visible";
transText.style.height="24px";
transText.style.font = '12pt serif';
transText.setAttribute('class',"loginTextboxstyleTrans");
transText.readOnly=true;
document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("tagTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > "; }
}
 }


if (seq==3) {
document.getElementById("titleTransliterate").style.visibility="hidden";
document.getElementById("tagTransliterate").style.visibility="hidden";
rawText=document.getElementById("rawbody");
transText=document.getElementById("bodytext");

document.getElementById("bodyTransliterate").style.left="300px";
document.getElementById("bodyTransliterate").style.top="0px";
document.getElementById("bodyTransliterate").style.visibility="visible";
//transText.style.height="24px";
transText.style.font = '12pt serif';
//transText.setAttribute('class',"loginTextboxstyleTrans");
transText.readOnly=true;
document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("tagTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > "; }
}
 }



}


function closeTitleTransliterationWindow(seq) {

var rawText;
var transText;
if (seq==1) {
rawText=document.getElementById("rawtitle");
transText=document.getElementById("title");
document.getElementById("transliterateClick"+seq).disabled=false;
transText.readOnly=false;
}


}

function toggleLogin(){

if (document.getElementById('loginrow').style.display=="none")
{
document.getElementById('loginrow').style.display="";
}
else {

document.getElementById('loginrow').style.display="none";
}
}

function redirect(url) {

location.href=url;
}

function redirectIndex(langDropdn) {

var rForm=document.getElementById('dummyForm');

if (langDropdn.options[langDropdn.selectedIndex].value>1)
{
location.href="http://"+langDropdn.options[langDropdn.selectedIndex].text.toLowerCase()+".yuyam.com";
} else
{
location.href="http://www.yuyam.com";

}
//

/*
rForm.action=langDropdn.options[langDropdn.selectedIndex].text.toLowerCase()
rForm.languageId.value=langDropdn.options[langDropdn.selectedIndex].value;
rForm.submit();
*/
}
/*
function redirectIndex(langDropdn) {

var rForm=document.getElementById('dummyForm');

rForm.languageId.value=langDropdn.options[langDropdn.selectedIndex].value;
rForm.submit();

}*/


function redirectSearch(langDropdn){

var rForm=document.getElementById('thisform');

rForm.languageId.value=langDropdn.options[langDropdn.selectedIndex].value;
rForm.submit();


}

function redirectCategory(category) {

var rForm=document.getElementById('dummyForm');
var langDropdn=document.getElementById('dummyForm');
rForm.languageId.value=langDropdn.options[langDropdn.selectedIndex].value;
rForm.submit();

}

function showLayer(layerName){
var l = document.getElementById(layerName);
var l1 = document.getElementById('searchIndic');

if (l.style.display=="none")
{
l1.style.top='5px';
l.style.display="inline";}
else {
l1.style.top='20px';
l.style.display="none";
}

}

function setDiv(){
var l = document.getElementById('searchIndic');
alert(l.style.top);

/*if (l.style.display=="none")
{l.style.display="";}
else {l.style.display="none";}
*/
}

function openMessageTransliterationWindow(seq) {

var rawText;
var transText;
if (seq==1) {
document.getElementById("bodyTransliterate").style.visibility="hidden";
rawText=document.getElementById("rawtitle");
transText=document.getElementById("msg_subject");

document.getElementById("subjectTransliterate").style.left="300px";
document.getElementById("subjectTransliterate").style.top="0px";
document.getElementById("subjectTransliterate").style.visibility="visible";
transText.style.height="24px";
transText.style.font = '12pt serif';
transText.setAttribute('class',"loginTextboxstyleBigger");
transText.readOnly=true;
//document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("titleTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > "; }
}
 }



if (seq==2) {
document.getElementById("subjectTransliterate").style.visibility="hidden";
rawText=document.getElementById("rawtitle");
transText=document.getElementById("msg_body");

document.getElementById("bodyTransliterate").style.left="300px";
document.getElementById("bodyTransliterate").style.top="0px";
document.getElementById("bodyTransliterate").style.visibility="visible";
//transText.style.height="24px";
transText.style.font = '12pt serif';
//transText.setAttribute('class',"loginTextboxstyleBigger");
transText.readOnly=true;
//document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("titleTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > "; }
}
 }



}


function toggleSearch(){

var l1=document.getElementById("search");
var l2=document.getElementById("searchGoogle");

if (l1.style.display=="none"){
l1.style.display="";
l2.style.display="none";
} else
{
l2.style.display="";
l1.style.display="none";


}



}


function toggleSearchIndic(){

var l1=document.getElementById("searchIndic");
var l2=document.getElementById("searchIndicGoogle");

if (l1.style.display=="none"){
l1.style.display="";
l2.style.display="none";
} else
{
l2.style.display="";
l1.style.display="none";


}



}


function showLayerIndic(layerName){
var l = document.getElementById(layerName);
var l1 = document.getElementById('searchIndicGoogle');

if (l.style.display=="none")
{
l1.style.top='5px';
l.style.display="inline";}
else {
l1.style.top='20px';
l.style.display="none";
}

}

function openCommentTransliterationWindow(seq){


var rawText;
var transText;
if (seq==1) {
rawText=document.getElementById("rawcomment");
transText=document.getElementById("comment");

document.getElementById("commentTransliterate").style.left="300px";
document.getElementById("commentTransliterate").style.top="0px";
document.getElementById("commentTransliterate").style.visibility="visible";
//transText.style.height="24px";
transText.style.font = '12pt serif';
//transText.setAttribute('class',"loginTextboxstyleTrans");
transText.readOnly=true;
document.getElementById("transliterateClick"+seq).disabled=true;

if (transText.value == null || transText.value.length==0 )
{;
} else
{
if (document.getElementById("commentTransliterate").style.visibility!="visible") {
rawText.value="< "+transText.value+" > ";  }
}
 }


}


function searchYuyam(rForm){

//var rForm = formField.form;
rForm.action="search.php";
//rForm.method="post";
rForm.submit();

}


function searchWeb(rForm){

var searchForm=document.getElementById("searchbox_010072938443233116882:tr18ghmwaxc");
var client = document.createElement('INPUT');
var forid = document.createElement('INPUT');
var ie = document.createElement('INPUT');
var oe = document.createElement('INPUT');
var safe = document.createElement('INPUT');
var cof = document.createElement('INPUT');
var q = document.createElement('INPUT');
      if (document.all) { // what follows should work
                          // with NN6 but doesn't in M14
        client.type = 'hidden'; client.name = 'client'; client.value = "pub-0707503928905973";
        forid.type = 'hidden'; forid.name = 'forid'; forid.value = "1";
        ie.type = 'hidden'; ie.name = 'ie'; ie.value = "UTF-8";
        oe.type = 'hidden'; oe.name = 'oe'; oe.value = "UTF-8";
        safe.type = 'hidden'; safe.name = 'safe'; safe.value = "active";
        cof.type = 'hidden'; cof.name = 'cof'; cof.value = "GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:11";
        q.type = 'hidden'; q.name = 'q';
       // alert(q);
      }
      else if (document.getElementById) { // so here is the
                                          // NN6 workaround
        client.setAttribute('type', 'hidden'); client.setAttribute('name', 'client'); client.setAttribute('value', "pub-0707503928905973");
        forid.setAttribute('type', 'hidden'); forid.setAttribute('name', 'forid'); forid.setAttribute('value', "1");
        ie.setAttribute('type', 'hidden'); ie.setAttribute('name', 'ie'); ie.setAttribute('value', "UTF-8");
        oe.setAttribute('type', 'hidden'); oe.setAttribute('name', 'oe'); oe.setAttribute('value', "UTF-8");
        safe.setAttribute('type', 'hidden'); safe.setAttribute('name', 'safe'); safe.setAttribute('value', "active");
        cof.setAttribute('type', 'hidden'); cof.setAttribute('name', 'cof'); cof.setAttribute('value', "GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:11");
        q.setAttribute('type', 'hidden'); q.setAttribute('name', 'q');
      }
      q.value = rForm.search.value;
    rForm.appendChild(client);
    rForm.appendChild(forid);
    rForm.appendChild(ie);
    rForm.appendChild(oe);
    rForm.appendChild(safe);
    rForm.appendChild(cof);
    rForm.appendChild(q);

//var rForm = formFiel

//rForm.q.value=rForm.search.value;
rForm.action="websearch.php";
rForm.submit();

}


function startSearch()
{
var rForm = document.thisform;
var radioObj= rForm.searchradio;
if (isWhitespace(rForm.search.value))
{
alert("No search string specified");
return;
}
if (radioObj[0].checked){
searchCoopWeb(rForm);
} else {
searchYuyam(rForm);
}

}

// BOI, followed by one or more whitespace characters, followed by EOI.
var reWhitespace = /^\s+$/;

// Returns true if string s is empty or
// whitespace characters only.

function isWhitespace (s) {
   // Is s empty?
    return (isEmpty(s) || reWhitespace.test(s));
}

// ALL is considered to be empty
function isAllEmpty (thisVar) {

	if ((thisVar == '') || (thisVar == 'ALL')) {
		return true;
	} else {
		return false;
	}
}



// general purpose function to see if an input value has been entered at all
function isEmpty(inputStr) {
	if (inputStr == "" || inputStr == null) {
		return true
	}
	return false
}



function searchCoopWeb(rForm){


var searchForm=document.getElementById("searchbox_010072938443233116882:tr18ghmwaxc");
var cx = document.createElement('INPUT');
var forid = document.createElement('INPUT');
var ie = document.createElement('INPUT');
var oe = document.createElement('INPUT');
var sa = document.createElement('INPUT');
var cof = document.createElement('INPUT');
var q = document.createElement('INPUT');
var client = document.createElement('INPUT');
var selectLang = document.createElement('INPUT');


      if (document.all) { // what follows should work
                          // with NN6 but doesn't in M14
        client.type = 'hidden'; client.name = 'client'; client.value = "pub-0707503928905973";
        cx.type = 'hidden'; cx.name = 'cx'; cx.value = "010072938443233116882:tr18ghmwaxc";
        forid.type = 'hidden'; forid.name = 'forid'; forid.value = "1";
        ie.type = 'hidden'; ie.name = 'ie'; ie.value = "UTF-8";
        oe.type = 'hidden'; oe.name = 'oe'; oe.value = "UTF-8";
        sa.type = 'hidden'; sa.name = 'sa'; sa.value = "Search";
        cof.type = 'hidden'; cof.name = 'cof'; cof.value = "FORID:9";
        q.type = 'hidden'; q.name = 'q';
        selectLang.type = 'hidden'; selectLang.name = 'selectLang';

       // alert(q);
      }
      else if (document.getElementById) { // so here is the
                                          // NN6 workaround
        client.setAttribute('type', 'hidden'); client.setAttribute('name', 'client'); client.setAttribute('value', "pub-0707503928905973");
        cx.setAttribute('type', 'hidden'); cx.setAttribute('name', 'cx'); cx.setAttribute('value', "010072938443233116882:tr18ghmwaxc");
        forid.setAttribute('type', 'hidden'); forid.setAttribute('name', 'forid'); forid.setAttribute('value', "1");
        ie.setAttribute('type', 'hidden'); ie.setAttribute('name', 'ie'); ie.setAttribute('value', "UTF-8");
        oe.setAttribute('type', 'hidden'); oe.setAttribute('name', 'oe'); oe.setAttribute('value', "UTF-8");
        sa.setAttribute('type', 'hidden'); sa.setAttribute('name', 'sa'); sa.setAttribute('value', "Search");
        cof.setAttribute('type', 'hidden'); cof.setAttribute('name', 'cof'); cof.setAttribute('value', "FORID:9");
        q.setAttribute('type', 'hidden'); q.setAttribute('name', 'q');
        selectLang.setAttribute('type', 'hidden'); selectLang.setAttribute('name', 'selectLang');

      }
     q.value = rForm.search.value;
     selectLang.value = rForm.selectLang.value;

    searchForm.appendChild(cx);
//    rForm.appendChild(forid);
  //  rForm.appendChild(ie);
    //rForm.appendChild(oe);
    searchForm.appendChild(sa);
    searchForm.appendChild(cof);
    searchForm.appendChild(q);
    searchForm.appendChild(selectLang);

//     rForm.appendChild(client);

//var rForm = formFiel

//rForm.q.value=rForm.search.value;
searchForm.action="websearch.php";
searchForm.method="GET";
searchForm.submit();

}


/*
<!-- Google CSE Search Box Begins -->
  <form id="searchbox_010072938443233116882:tr18ghmwaxc" action="http://www.google.com/search">
    <input type="hidden" name="cx" value="010072938443233116882:tr18ghmwaxc" />
    <input type="hidden" name="cof" value="FORID:1" />
    <input name="q" type="text" size="40" />
    <input type="submit" name="sa" value="Search" />
    <img src="http://www.google.com/coop/images/google_custom_search_smnar.gif" alt="Google Custom Search" />
  </form>
<!-- Google CSE Search Box Ends -->
*/


function showHelp(){
var doc =document.getElementById("langHelp");
if (doc.style.visibility=="hidden")
{
doc.style.visibility="visible";
}else
{
doc.style.visibility="hidden";
}

}

function openSupWindow(pageUrl) {

   //if (pageUrl.substring(0,4).toUpperCase() != "HTTP") {
     // pageUrl="http://"+pageUrl;
   //}

   openDescWindow = top.window.open(pageUrl, 'openDescWindow', 'scrollbars=yes,status=no,width=600,height=400,screenX=450,left=420,top=0, dependent=no,toolbar=no,menubar=no,resizable=no');
   openDescWindow.focus();
   openDescWindow.document.close();

}

function showmenu(elmnt)
{
if (document.getElementById(elmnt).style.visibility=="visible")
  {
  document.getElementById(elmnt).style.visibility="hidden";
  } else {
  document.getElementById(elmnt).style.visibility="visible";
  }
}
function hidemenu(elmnt)
{
document.getElementById(elmnt).style.visibility="hidden"
}


function showEmbedVideo(htmlid, linkid)
{
        var emailtodisplay=document.getElementById('embedvideo-'+htmlid).style.display ? '' : 'none';
        document.getElementById('embedvideo-'+htmlid).style.display = emailtodisplay;



        if (xmlhttp) {
                url = "http://malayalam.yuyam.com/out.php";
                content = "id=" + linkid+'&htmlid='+htmlid;
                target2 = document.getElementById ('embedvideo-'+htmlid);
                target2.innerHTML = "<br>Loading, please wait....";

                mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
                if (mnmxmlhttp) {
                        mnmxmlhttp[htmlid].open ("POST", url, true);
                        mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
                                           'application/x-www-form-urlencoded');

                        mnmxmlhttp[htmlid].send (content);
                        errormatch = new RegExp ("^ERROR:");

                        target1 = document.getElementById ('embedvideo-'+htmlid);

                        mnmxmlhttp[htmlid].onreadystatechange = function () {
                                if (mnmxmlhttp[htmlid].readyState == 4) {
                                        mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

                                        if (mnmString[htmlid].match (errormatch)) {
                                                mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

                                                target2 = document.getElementById ('embedvideo-'+ htmlid);
                                                target2.innerHTML = mnmString[htmlid];

                                        } else {
                                                target2 = document.getElementById ('embedvideo-'+ htmlid);
                                                target2.innerHTML = mnmString[htmlid];

                                 }
                                }
                        }
                }
        }
}

function report_abuse(htmlid, linkid)
{
  var emailtodisplay=document.getElementById('reportAbuseLayer-' + htmlid).style.display ? '' : 'none';
	document.getElementById('reportAbuseLayer-' + htmlid).style.display = emailtodisplay;



	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/reportabuse.php";
		content = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('reportAbuseLayer-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}


function submit_abuse(original_id, htmlid )
{

	abuseReason= document.getElementById('abuseReason-' + htmlid);
	rForm= document.getElementById('reportAbuseForm-'+ htmlid);
	abuseReason= rForm.abuseReason;
	abuseReasonChecked=false;
	abuseReasonValue='';
	for (var i=0;i<abuseReason.length;i++)
	  {
		if (abuseReason[i].checked) {

		abuseReasonChecked=true;
		abuseReasonValue +=abuseReason[i].value+",";
		}
	  }

	  if (!abuseReasonChecked){

	  alert("Please select reason why you think its an abusive message");
	  return;
	  }


	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/reportabuse.php";
		content = "abuseReason=" + abuseReasonValue + "&linkid=" + original_id+"&abuse_to_submit=yes" ;
		target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
		target2.innerHTML = "<br>Submitting, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('reportAbuseLayer-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('reportAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}


function report_comment_abuse(htmlid, linkid)
{
  var emailtodisplay=document.getElementById('reportCommentAbuseLayer-' + htmlid).style.display ? '' : 'none';
	document.getElementById('reportCommentAbuseLayer-' + htmlid).style.display = emailtodisplay;



	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/commentabuse.php";
		content = "draw=small&htmlid=" + htmlid + "&commentid=" + linkid;
		target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}



function submit_comment_abuse(original_id, htmlid )
{

	rForm= document.getElementById('reportCommentAbuseForm-'+ htmlid);
	abuseReason= rForm.abuseCommentReason;
	abuseReasonChecked=false;
	abuseReasonValue='';
	for (var i=0;i<abuseReason.length;i++)
	  {
		if (abuseReason[i].checked) {

		abuseReasonChecked=true;
		abuseReasonValue +=abuseReason[i].value+",";
		}
	  }

	  if (!abuseReasonChecked){

	  alert("Please select reason why you think its an abusive comment");
	  return;
	  }


	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/commentabuse.php";
		content = "abuseReason=" + abuseReasonValue + "&commentid=" + original_id+"&abuse_to_submit=yes" ;
		target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
		target2.innerHTML = "<br>Submitting, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('reportCommentAbuseLayer-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}
function loadLanguageHelp(languageName)
{

 htmlid=200;

	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/yuyamsearchHelp.php";
		content = "languageName="+languageName;
		target2 = document.getElementById ('helpText');
		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('helpText');

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('helpText');
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('helpText');
						if (target2) {
						target2.innerHTML = mnmString[htmlid];
							}

					}
				}
			}
		}
	}
}

function inviteFriends(user,htmlid, linkid, instpath)
{
  if (user == '0') {

	if (window.event) {

           window.event.returnValue = false;
           window.event.cancelBubble = true;//stop the event being passed to higher level
	}
            window.location="http://malayalam.yuyam.com/login.php?return="+location.href;
	//window.location.href.assign("http://malayalam.yuyam.com/login.php?return="+location.href) ;
            return;
         }
	var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
	document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;

	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/inviteFriends.php";
		content = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('emailto-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}

function group_emailto (original_id, htmlid, instpath, address_count)
{
	email_message = document.getElementById('email_message' + htmlid).value;
	email_address = document.getElementById('email_address_1_' + htmlid).value;
	if (address_count > 1){
		for ($i = 2; $i <= address_count; $i++) {
			if(document.getElementById('email_address_' + $i + '_' + htmlid).value != "") {
				email_address = email_address + ', ' + document.getElementById('email_address_' + $i + '_' + htmlid).value;
			}
		}
	}

	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/inviteFriends.php";
		content = "email_address=" + escape(email_address) + "&email_to_submit=submit&email_message=" + escape(email_message) + "&original_id=" + original_id + "&backup=0";
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Sending, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('emailto-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
					mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}

function show_recommend1(user,htmlid, linkid, instpath)
{
  if (user == '0') {

	if (window.event) {

           window.event.returnValue = false;
           window.event.cancelBubble = true;//stop the event being passed to higher level
	}
            window.location="http://malayalam.yuyam.com/login.php?return="+location.href;
	//window.location.href.assign("http://malayalam.yuyam.com/login.php?return="+location.href) ;
            return;
         }
	var emailtodisplay=document.getElementById('emailto-' + htmlid).style.display ? '' : 'none';
	document.getElementById('emailto-' + htmlid).style.display = emailtodisplay;



	if (xmlhttp) {
		url = "http://malayalam.yuyam.com/inviteFriends.php";
		content = "draw=small&htmlid=" + htmlid + "&linkid=" + linkid;
		target2 = document.getElementById ('emailto-' + htmlid);
		target2.innerHTML = "<br>Loading, please wait....";

		mnmxmlhttp[htmlid] = new myXMLHttpRequest ();
		if (mnmxmlhttp) {
			mnmxmlhttp[htmlid].open ("POST", url, true);
			mnmxmlhttp[htmlid].setRequestHeader ('Content-Type',
					   'application/x-www-form-urlencoded');

			mnmxmlhttp[htmlid].send (content);
			errormatch = new RegExp ("^ERROR:");

			target1 = document.getElementById ('emailto-' + htmlid);

			mnmxmlhttp[htmlid].onreadystatechange = function () {
				if (mnmxmlhttp[htmlid].readyState == 4) {
					mnmString[htmlid] = mnmxmlhttp[htmlid].responseText;

					if (mnmString[htmlid].match (errormatch)) {
						mnmString[htmlid] = mnmString[htmlid].substring (6, mnmString[htmlid].length);

						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					} else {
						target2 = document.getElementById ('emailto-' + htmlid);
						target2.innerHTML = mnmString[htmlid];

					}
				}
			}
		}
	}
}

