var opencount=amt();
var inwidth=screen.width;

function dw(wrd){document.write(wrd);}
// <-----------VIEWTIMER BEGINS----------
function viewtimes()
{
document.write(opencount);
}
// -----------VIEWTIMER ENDS---------->

//<------------Navigation rollover--------
function menurollover(m,img) 
{
//alert(img);
m.style.backgroundImage= "url("+img+")";
m.style.backgroundRepeat= "repeat-y"; 
m.style.backgroundPosition= "center top";
}

function hmenurollover(m,img) 
{
//alert(img);
m.style.backgroundImage= "url("+img+")";
m.style.backgroundRepeat= "repeat-x"; 
m.style.backgroundPosition= "left top";
}



//------------Navigation rollover-------->

///locating aword
function locateaword()
{
locateaword=GetCookie('locateaword');
if(locateaword)
findInPage(locateaword);
SetCookie('locateaword',"");
}


// <-----------COOKIE BEGINS---------->
function GetCookie (name) {  
var arg = name + "=";  
var alen = arg.length;  
var clen = document.cookie.length;  
var i = 0;  
while (i < clen) {
var j = i + alen;    
if (document.cookie.substring(i, j) == arg)      
return getCookieVal (j);    
i = document.cookie.indexOf(" ", i) + 1;    
if (i == 0) break;   
}  
return null;
}


function SetCookie (name, value) 
{  
var argv = SetCookie.arguments;  
var argc = SetCookie.arguments.length;  
var expires = (argc > 2) ? argv[2] : null;  
var path = (argc > 3) ? argv[3] : null;  
var domain = (argc > 4) ? argv[4] : null;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}


function DeleteCookie (name) 
{  
var exp = new Date();  
exp.setTime (exp.getTime() - 1);   
var cval = GetCookie (name);  
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var expDays = 1;
var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));


function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','2')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
   }
}


function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

// -----------COOKIE ENDS---------->


///find

var win = window; // window to search.
var findInPage_n = 0;
function findInPage(str) 
{
//alert("This is "+str);
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);
var txt, i, found;

if (str == "")return false;

// Find next occurance of the given string on the page, wrap around to the start of the page if necessary.
if (NS4) 
	{// Look for match starting at the current point. If not found, rewind back to the first match.
	if (!win.find(str))
	while(win.find(str, false, true))
	findInPage_n++;
else
	findInPage_n++;
	// If not found in either direction, give message.
	if (findInPage_n == 0)
	alert("Not found.");
	}

if (IE4) 
	{
	txt = win.document.body.createTextRange();
	// Find the nth match from the top of the page.
	for (i = 0; i <= findInPage_n && (found = txt.findText(str)) != false; i++) 
		{
		txt.moveStart("character", 1);
		txt.moveEnd("textedit");
		}
	// If found, mark it and scroll it into view.
	if (found) 
		{
		txt.moveStart("character", -1);
		txt.findText(str);
		txt.select();
		txt.scrollIntoView();
		findInPage_n++;
		//focus(document.sname.I1);
		}
		// Otherwise, start over at the top of the page and find first match.
		else 
		{
		if (findInPage_n > 0) 
			{
			findInPage_n = 0;
			findInPage(str);
			}
			// Not found anywhere, give message.
			else
			alert("Not found.");
		}
	}

return false;
}
function displaydefault(pager)//DISPLAYS OF filebuttons($type) OF WF_COMMON
{
document.getElementById('new2create').style.display = 'none';
document.getElementById('create').style.display = 'none';
document.getElementById('create_open').style.display = 'inline';
document.getElementById('newurl').style.display = 'none';
document.getElementById('open').style.display = 'none';
document.getElementById('open_open').style.display = 'inline';
document.getElementById('save').style.display = 'none';
document.getElementById('save_open').style.display = 'inline';
document.getElementById('saveasname').style.display = 'none';
document.getElementById('saveas').style.display = 'none';
document.getElementById('saveas_open').style.display = 'inline';

document.getElementById('delete').style.display = 'none';
document.getElementById('delete_open').style.display = 'inline';
if(pager=='true')
	{
	document.getElementById('save2pager').style.display = 'none';
	document.getElementById('save2pager_open').style.display = 'inline';
	document.getElementById('fix2pager').style.display = 'none';
	document.getElementById('fix2pager_open').style.display = 'inline';
	}


document.getElementById('linespace').style.display = 'inline';
}

function hidelinespace(pager)
{
displaydefault(pager);
document.getElementById('linespace').style.display = 'none';
}

function searchform()
{
dw("<table border=\"0\" style=\"font-size: 8pt; border-collapse: collapse\" bordercolor=\"#111111\" width=\"100\" cellpadding=\"1\">");
dw("<form method=\"POST\" action=\"wf_results.php\">");
dw("   <tr> <td width=\"100%\" align=\"center\"><input type=\"text\" name=\"searchword\" size=\"15\" class=light value=\"Search\"></td></tr>");
dw("</form>");
dw("</table>");
}

function boxbegins(theading,twidth)
{
dw("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" class=box>");
dw("  <tr>");
dw("    <td align=\"right\" valign=\"bottom\">");
dw("			<img src=\"skinimages/box_01.gif\" width=7 height=7></td>");
dw("    <td style=\"background-image: url('skinimages/box_02.gif'); background-repeat: repeat-x; background-position: left bottom\">&nbsp;</td>");
dw("    <td align=\"left\" valign=\"bottom\">");
dw("			<img src=\"skinimages/box_03.gif\" width=7 height=7></td>");
dw("  </tr>");

if(theading)
{
dw("<tr><td style=\"background-image: url('skinimages/box_04.gif'); background-repeat: repeat-y; background-position: right top\">&nbsp;</td>");
dw("<td  style=\"font-size: 8pt;padding:2;font-weight: bold;\" align=center class=dark>"+theading+"</td>");
dw("<td style=\"background-image: url('skinimages/box_06.gif'); background-repeat: repeat-y; background-position: left top\"></td></tr>");
}
dw("  <tr>");
dw("    <td style=\"background-image: url('skinimages/box_04.gif'); background-repeat: repeat-y; background-position: right top\">&nbsp;</td>");
if(twidth)
dw("    <td  style=\"font-size: 8pt\" width="+twidth+"  background=\"skinimages/box_05.gif\">");
else
dw("    <td  style=\"font-size: 8pt\" width=\"100%\" background=\"skinimages/box_05.gif\">");
}

function boxends()
{
dw("    </td>");
dw("    <td style=\"background-image: url('skinimages/box_06.gif'); background-repeat: repeat-y; background-position: left top\"></td>");
dw("  </tr>");
dw("  <tr>");
dw("    <td align=\"right\" valign=\"top\">");
dw("			<img src=\"skinimages/box_07.gif\" width=7 height=7></td>");
dw("    <td style=\"background-image: url('skinimages/box_08.gif'); background-repeat: repeat-x; background-position: left top\">&nbsp;</td>");
dw("    <td align=\"left\" valign=\"top\">");
dw("			<img src=\"skinimages/box_09.gif\" width=7 height=7></td>");
dw("  </tr>");
dw("</table>");
}

function boxnewbegins()
{
dw("<div class=rounded-box><div class=top-left-corner><div class=top-left-inside>•</div></div><div class=bottom-left-corner><div class=bottom-left-inside>•</div></div><div class=top-right-corner><div class=top-right-inside>•</div></div><div class=bottom-right-corner><div class=bottom-right-inside>•</div></div><div class=box-contents>");
}

function boxnewends()
{
dw("</div>");
}
function showloader()
{
dw ("<div id=\"loadingimg\" align=centre><b>Loading..</b><br>");
for(a=0;a<10;a++)
dw("<img src='skinimages/00loading.gif'></div>");
}


function doafterload()
{
document.getElementById('loadingimg').style.display = 'none';
document.getElementById('preloads').style.display = 'none';
document.getElementById('shortcutlayer').style.display = 'inline';
document.getElementById('mainlayer').style.display = 'inline';
locateaword();
}

function colerpallette()
{
dw("<div id=\"plugin\" class=dark onmousedown=\"HSVslide('drag','plugin',event)\" style=\"TOP: 280px; LEFT: 530px; Z-INDEX: 20;\">");
dw(" <div id=\"plugHEX\" onmousedown=\"stop=0; setTimeout('stop=1',100);\">F1FFCC</div><div id=\"plugCLOSE\" onmousedown=\"toggle('plugin')\">X</div><br>");
dw(" <div id=\"SV\" onmousedown=\"HSVslide('SVslide','plugin',event)\" title=\"Saturation + Value\">");
dw("  <div id=\"SVslide\" style=\"TOP: -4px; LEFT: -4px;\"><br /></div>");
dw(" </div>");
dw(" <form id=\"H\" onmousedown=\"HSVslide('Hslide','plugin',event)\" title=\"Hue\">");
dw("  <div id=\"Hslide\" style=\"TOP: -7px; LEFT: -8px;\"><br /></div>");
dw("  <div id=\"Hmodel\"></div>");
dw(" </form>");
dw("</div>");
}
var offsetx,offsety;
function wherexwherey(e)
{
offsetx=document.all ? event.clientX : e.clientX;
offsety=document.all ? event.clientY : e.clientY;
}


function display_two_boxes()
{
dw("<div class=dark style=\"position:static;width=45;height=45;\">");
dw(" <div style=\"position:absolute;width=30;height=30;left:15;top:15;border-style: solid; border-width: 1\" id=\"paletcolorshow_bg\"  name=\"paletcolorshow_bg\" onClick=\"alert();inpalletbgcolor();assignpalletvalues(focusline);\"></div>");
dw(" <div style=\"position:absolute;width=30;height=30;left:0;top:0;border-style: solid; border-width: 1\" id=\"paletcolorshow_fg\"  name=\"paletcolorshow_fg\" onClick=\"inpalletcolor();assignpalletvalues(focusline);\"></div>");
dw("</div>");
}

function findpagedetails(wrd,whichwrd,whichreturn)///0=title,1=url,2=desc,3=pagepass
{
for(fpd=0;fpd<pagedetails.length;fpd++)
	{
	line=pagedetails[fpd].split('¤');
	if(line[whichwrd].toLowerCase()==wrd.toLowerCase())
		if(line[whichreturn])
		{
		return(line[whichreturn]);
		break;
		}
	}
}

function findsubmenus(url)
{
for(fs=0;fs<pagedetails.length;fs++)
	{
	line=pagedetails[fs].split('¤');
	if(line[1]==url)
		if(line[3])
		{
		return(line[3].split('|'));
		break;
		}
	}
return false;
}

function verticalmenu()
{
var menusub="&nbsp;<img src='images/menusub.gif' border='0'>&nbsp;";
var menumain="&nbsp;<img src='images/menumain.gif' border='0'>&nbsp;";
var menuthis="&nbsp;<img src='images/menuthis.gif' border='0'>&nbsp;";

vmenuitems=vertical_menu_links_array.split("¤");
dw("<div class=\"vmenubox\" style=\"cursor:pointer\">");
for(a=0;a<vmenuitems.length;a++)
	{
	mainurl=vmenuitems[a];
	mainpagepass=findpagedetails(mainurl,1,4);
	if(mainpagepass>=userpasslevel)
		{
		maintitle=findpagedetails(mainurl,1,0);
		maindesc=findpagedetails(mainurl,1,2);
		
		sub=findsubmenus(mainurl);
		dw("<span ");
		if(thispagetitlename!=maintitle && sub.length>0)
		dw(" onmouseout=\"document.getElementById('"+maintitle+"').style.display='none'\" onmouseover=\"document.getElementById('"+maintitle+"').style.display='inline'\" ");
		dw(">");
		if(thispagetitlename==maintitle)
			{
			dw("<div class=\"vmenuboxmain\" >"+menuthis+maintitle.toUpperCase()+"</div> ");
			}
		else
		if(maintitle.toLowerCase()!='signup' )
			{
			
			dw("<div class=\"vmenuboxinner\"  onmouseover=\"ddrivetip('"+maindesc+"','');\"  onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+mainurl+"'\" ><a href='"+mainurl+"'>");
			if(sub.length>0)
				dw(menusub);
				else
				dw(menumain);				
			dw(maintitle.toUpperCase()+"</a></div>");
			}
			else
			if(userpasslevel==4)
			dw("<div class=\"vmenuboxinner\"  onmouseover=\"ddrivetip('"+maindesc+"','');\"  onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+mainurl+"'\" ><a href='"+mainurl+"'>"+menumain+maintitle.toUpperCase()+"</a></div>");
		if(sub.length>0)
			{
			dw("<div id=\""+maintitle+"\" "); 
			if(thispagetitlename!=maintitle)
			 	dw(" style=\"display:none\" "); 
			dw(" >");
			for(b=0;b<sub.length;b++)
				{
				desc=findpagedetails(sub[b],0,2);
				url=findpagedetails(sub[b],0,1);
				if(thispagetitlename==sub[b])
					{ 
					document.getElementById(maintitle).style.display='inline';
					dw("<div class=\"vmenuboxmain\" >&nbsp;&nbsp;&nbsp;&nbsp;"+menuthis+sub[b].toUpperCase()+"</div> ");
					}
				else if(sub[b].toLowerCase()!='signup' )
					{
					subpagepass=findpagedetails(url,1,4);
					if(subpagepass>=userpasslevel)
						dw("<div class=\"vmenuboxinnersub\" onmouseover=\"ddrivetip('"+desc+"','');\"  onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+url+"'\" ><a href='"+url+"'>&nbsp;&nbsp;&nbsp;&nbsp;"+menumain+sub[b].toUpperCase()+"</a></div>");
					}
				else if(userpasslevel==4)	
					dw("<div class=\"vmenuboxinnersub\" onmouseover=\"ddrivetip('"+desc+"','');\"  onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+url+"'\" ><a href='"+url+"'>&nbsp;&nbsp;&nbsp;&nbsp;"+menumain+sub[b].toUpperCase()+"</a></div>");
				}
			dw("</div>");
			}
			
		dw("</span>");
		}
	}
dw("</div>");	
}

function horizontalmenu()
{
hmenuitems=horizontal_menu_links.split('¤');

dw("<div class=\"hmenustrip\" style=\"cursor:pointer;\" width='100%' align=center><div  class='hmenuleft' style=\"float:left\"></div><div style=\"float:right\">");
for(a=0;a<hmenuitems.length;a++)
	{
	mainhurl=hmenuitems[a];
	mainhtitle=findpagedetails(mainhurl,1,0);
	mainhdesc=findpagedetails(mainhurl,1,2);
	sub=findsubmenus(mainhurl);
	mainpagepass=findpagedetails(mainhurl,1,4);
	if(mainpagepass>=userpasslevel)
		{
		dw("<div class=\"hmenuboxbreak\" style=\"float:left\"></div><div class=\"hmenuboxinner\" style=\"float:left\"> ");
		dw("<span ");
		if(thispagetitlename!=mainhtitle && sub.length>0)
		dw(" onmouseout=\"document.getElementById('h"+mainhtitle+"').style.display='none'\" onmouseover=\"document.getElementById('h"+mainhtitle+"').style.display='inline'\" ");
		dw(">");
		
		if(thispagetitlename==mainhtitle)
		dw("<div class=\"hmenuboxinner\" style=\"color:#FFFFFF;font-weight:bold;\"><a href='"+mainhurl+"'>"+mainhtitle.toUpperCase()+"</a></div>");
		else
		if(mainhtitle.toLowerCase()!='signup' )
			dw("<div class=\"hmenuboxinner\"  onmouseover=\"ddrivetip('"+mainhdesc+"',''); \" onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+mainhurl+"'\" ><a href='"+mainhurl+"'>"+mainhtitle.toUpperCase()+"</a></div>");
		else
		if(userpasslevel==4)
			dw("<div class=\"hmenuboxinner\"  onmouseover=\"ddrivetip('"+mainhdesc+"',''); \" onmouseout=\"hideddrivetip();\"  onClick=\"document.location='"+mainhurl+"'\" ><a href='"+mainhurl+"'>"+mainhtitle.toUpperCase()+"</a></div>");

		sub=findsubmenus(mainhurl);
		
		if(sub.length>0)
			{
			
			dw("<div  class=\"hmenupopupmain\" id='h"+mainhtitle+"' onmouseout=\"document.getElementById('"+mainhtitle+"').style.display='none';\"> ");
			for(b=0;b<sub.length;b++)
				{
				desc=findpagedetails(sub[b],0,2);
				url=findpagedetails(sub[b],0,1);
				subpagepass=findpagedetails(url,1,4);
				if(subpagepass>=userpasslevel)
					if(thispagetitlename!=sub[b])
					{
					dw(" ");
					if(sub[b].toLowerCase()!='signup') 
						dw("<div class=\"hmenupopup\"  onmouseover=\"ddrivetip('"+desc+"','');\"  onmouseout=\"hideddrivetip();\" ><a href='"+url+"'>"+sub[b].toUpperCase()+"</a></div> ");
					else if(userpasslevel==4)
						dw("<div class=\"hmenupopup\"  style=\"float:left\" onmouseover=\"ddrivetip('"+desc+"','');\"  onmouseout=\"hideddrivetip();\" >c<a href='"+url+"'>"+sub[b].toUpperCase()+"</a></div> ");
					
					}				
					
				}
				
			dw("</div> ");
			}
		dw("</div> ");
		dw("</span> ");
		if((a+1)<hmenuitems.length)
		dw("<div class=\"hmenuboxinner\" style=\"float:left\"></div> ");
		
		}
	}
dw("<div  class='hmenuright' style=\"float:left\"></div></div></div>");	
}
function none()
{
document.write("");
}

function focuslayer(layername)
{
alert(layername);
focusname=document.getElementById('focusclass').value.split('#');
}

function pageicon()
{
document.write("<img src='"+pageiconname+"'>");
}

function copyrightdisplay()
{
document.write("© 2004 "+copyright);
}

function scroller()
{
RunScroller();
}

function hitcounter()
{
document.write(hitcount);
}

function topbanner()
{
document.write(this_pagentb);
}

function textbox()
{
document.write(this_pageatb);
}

function adbox()
{
document.write(googleadbox);
}

function findheight(imgname)
{
var newImg = new Image();
newImg.src = imgname;
return newImg.height;
}


function findwidth(imgname)
{
var newImg = new Image();
newImg.src = imgname;
return newImg.width;
}


/////ajax

function readanddispaly(filename,displayplace)
{
 $.ajax({type: "GET",url: filename, success: function(result){ document.getElementById(displayplace).innerHTML= result; } });
}

function writeanddisplay(filename,transferingdata,displayplace)
{
 $.ajax({
   type: "POST",
   url: filename,
   data: transferingdata,
   success: function(result)
   { document.getElementById(displayplace).innerHTML= result; }
 });


}