function changeBg(which) {

document.getElementById('q').style.backgroundImage="url('')";
}

function pausecomp(millis)
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while(curDate-date < millis);
} 

function FuncShowHide(elm1,elm2,elm3){
  
  if (document.getElementById(elm2).style.display == document.getElementById(elm1).style.display){
	 document.getElementById(elm3).style.display = document.getElementById(elm1).style.display
	 document.getElementById(elm2).style.display = "none";
  } else {
	 document.getElementById(elm2).style.display = document.getElementById(elm1).style.display
	 document.getElementById(elm3).style.display = "none";
  }
}

function FuncShowHidePause(elm1,elm2,elm3){
  
 	 document.getElementById(elm3).style.display = document.getElementById(elm1).style.display
	 pausecomp(300);
	 document.getElementById(elm2).style.display = "none";
}

function FuncShow(elm1,elm2,elm3){
  
 if (document.getElementById(elm2).style.display == document.getElementById(elm1).style.display){
	 document.getElementById(elm2).style.display = "none";
  } else {
	 document.getElementById(elm2).style.display = document.getElementById(elm1).style.display;
	 document.getElementById(elm3).style.display = "none";
  }
}

function hideLayer(ObHide)
{
  document.getElementById(ObHide).style.visibility="hidden";
}

function showLayer(ObShow)
{
  document.getElementById(ObShow).style.visibility="visible";
}

var DHTML = (document.getElementById || document.all || document.layers);
var SwitchD = 294;

function getObj(name){

if (document.getElementById){
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all){
this.obj = document.all[name];
this.style = document.all[name].style;
}

else if (document.layers){
this.obj = document.layers[name];
this.style = document.layers[name];
}
}

function centerDiv(div,isID,xval,yval)
{
document.getElementById(isID).onmouseover = getMouseCoords;
}

function getMouseCoords(e) {
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) 	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY) 	{
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}
	// posx and posy contain the mouse position relative to the document
	// Do something with this information
}

	
function getRealLeft(el){
	xPos = document.getElementById(el).offsetLeft;
	tempEl = document.getElementById(el).offsetParent;
	while (tempEl != null) {
	xPos += tempEl.offsetLeft;
	tempEl = tempEl.offsetParent;
}
	return xPos;
}

function getRealTop(el){
	yPos = document.getElementById(el).offsetTop;
	tempEl = document.getElementById(el).offsetParent;
	while (tempEl != null) {
	yPos += tempEl.offsetTop;
	tempEl = tempEl.offsetParent;
}
	return yPos;
}

function sendme() 
{ 
    params  = 'width='+screen.width;
    params += ', height='+screen.height;
    params += ', top=0, left=0'
    params += ', resizable=yes'
    params += ', toolbar=yes'
    params += ', menubar=yes'
    params += ', location=yes'
    params += ', fullscreen=yes';
    window.open("","myNewWin", params); 
    var a = window.setTimeout("document.form1.submit();",500); 
} 

function display_image(form,w,h) {
	selectionname = form;
	selection = form;
	PreView = window.open("", "Preview", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=" + w + ",height=" + h);
	PreView.document.open();
	PreView.document.write("<HTML><HEAD>");
	PreView.document.write("<TITLE>Preview</TITLE>");
	PreView.document.write("<style type=text/css>body {margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;}</style>");
	PreView.document.write("</HEAD><BODY BGCOLOR=FFFFFF TEXT=000000>");
	PreView.document.write("<CENTER>");
	PreView.document.write("<IMG HSPACE=0 VSPACE=0 " +
	"SRC='" + selection + "'>");
	PreView.document.write("<HR><FORM><INPUT TYPE='button' VALUE='Close' " +
	"onClick='window.close()'></FORM>");
	PreView.document.write("</CENTER>");
	PreView.document.write("</BODY></HTML>");
	PreView.document.close();
}

function ChangeColor(tableRow, highLight, color) {
		if (highLight) {
			tableRow.style.backgroundColor = color;
		}
		else {
			tableRow.style.backgroundColor = color;
		}
}

function DoNav(theUrl) {
	document.location.href = theUrl;
}

function getQuerystring(key, default_)
{
  if (default_==null) default_="";
  key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
  var qs = regex.exec(window.location.href);
  if(qs == null)
    return default_;
  else
    return qs[1];
}

function FuncShowHide(elm1,elm2){
  
  if (document.getElementById(elm1).style.display == "block"){
	 document.getElementById(elm1).style.display = "none";
	 document.getElementById(elm2).style.display = "block";
  }
}

function CheckBeforeSubmit(FieldVal,Div1,Div2,Div3,Div4,DivName,DBEntryID,EncryptSQL,IsNumber){
	
	if(document.getElementById(FieldVal).value == ""){
		document.getElementById("txtHint").innerHTML = "Error";
	} else {
		showHint(document.getElementById(FieldVal).value,DivName,EncryptSQL,IsNumber);
		
		FuncShowHide(Div1,Div2);
		document.getElementById(Div3).innerHTML = document.getElementById(FieldVal).value;
		document.getElementById(Div4).innerHTML = document.getElementById(FieldVal).value;
		
  }
}
function OpenWYSIWYG(EncryptSQL,GetDiv) {
	PopUpWYSIWYG("WYSIWYG/WYSIWYG.asp?"+(EncryptSQL));
}
function PopUpWYSIWYG(URL) {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
} else if( document.documentElement &&
( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
}

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+ myWidth + 'px,height='+ myHeight + 'px,left = 710,top = 350');");
}
function OpenIMGEditor(IMGID) {
	PopUpWYSIWYG("IMGEditor.asp?IMGID="+IMGID);
}
