// JavaScript Document

function OnClickPager(page, pages, baseURL)
{
	var temp;
	var s;

	temp = String(page).match(/[0-9]+/g);
	if (temp != page ||  page <= 0) 
		page = '1';

	if ( page > pages)
		page = pages;
					
	s = baseURL + 'page=' + page;
	location = s;
}

 	
function delconfirm(thisform, title)
{
	if (confirm('Do you really want to delete ' + title + ' ?')) {
		thisform.submit();
	};
}

// Delete Category 
function delCategory(category_id, title, delurl)
{
	if (confirm('Do you really want to delete ' + title + ' category ? \n This operation will DELETE ALL sub-categories under this category!!!')) {
		location.href = delurl;
	};
}



function canelconfirm(thisform)
{
	if (confirm('Do you really want to cancel this order ?')) {
		thisform.submit();
	};
}


function safe_submit (button_id, form_id)
{
	var botton = document.getElementById(button_id);
	var form = document.getElementById(form_id) ;
	botton.disabled = disabled;
	form.subimt();
}

	
function showbigimage(imgsrc,imgwidth,imgheigh) {
	oPopupBody.style.border = "2px solid silver";
	oPopupBody.bgColor='#203F7F';
	oPopupBody.innerHTML = "<html><head><title>Demo</title></head><body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ><table width=100%  border=0 cellspacing=1 cellpadding=0><tr><td height=10 bgcolor=#203F7F background='/images/bgcell.gif'></div></td></tr><tr><td><img src='"+imgsrc+"' alt='Click to close'></td></tr></table></body></html>";
	oPopupWindow.show((window.screen.width - imgwidth) / 2,(window.screen.height - imgheigh) / 2,imgwidth,imgheigh);
}




/*
function openimagewin(imgsrc)
{
 	OpenWindow = window.open ("", "Design Detail", "height=720, width=800,left=0,top=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+scroll+",resizable=0") ;
	
	OpenWindow.document.write("<html><head><title>Design Detail</title></HEAD><body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 > ")
	OpenWindow.document.write("<div align='center'><img src="+imgsrc+" hspace=0 vspace=0 border=1 alt='Click to close' style=cursor:default onClick=javascript:window.close() ></div>")
	OpenWindow.document.write("</body></html>")
	OpenWindow.document.close()
}

function openimagewin(title,weight,imgsrc)
{
  splashWin = window.open ('', '', 'height=500, width='+weight+',left='+((window.screen.width - weight) / 2)+',top='+((window.screen.height - 800) / 2)+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0')
 	splashWin.document.write("<html><head><title>"+title+"</title><link rel='stylesheet' href='/style.css' type='text/css'></HEAD><body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 > ");
	splashWin.document.write("<div align='center'><a href=javascript:window.close() ><img src="+imgsrc+" hspace=0 vspace=0 border=0 alt='Click to close' style=cursor:default ></a></div>");
	splashWin.document.write("</body></html>");
	splashWin.document.close();
 }

*/

	
function fClick()	{

	var oPopupWindow = window.createPopup();
	var oPopupBody = oPopupWindow.document.body;
	oPopupWindow.document.body.onclick = fClick;

	var oSrcElement = 	oPopupWindow.document.parentWindow.event.srcElement;

if (oSrcElement.tagName == 'IMG')	{
			oPopupWindow.hide();
		}
}



// Open Promotion Popup Window

var WindowObjectReference = null; // global variable

function openFFPromotionPopup()
{
  if(WindowObjectReference == null || WindowObjectReference.closed)
  /* if the pointer to the window object in memory does not exist
	 or if such pointer exists but the window was closed */

  {
	WindowObjectReference = window.open("admin_news_picture_select.php",
	"selectWindow",
	 "toolbar=no,location=no,scrollbars=yes,resizable=yes,status=no,width=720,height=525");
	/* then create it. The new window will be created and
	   will be brought on top of any other window. */
  }
  else
  {
	WindowObjectReference.focus();
	/* else the window reference must exist and the window
	   is not closed; therefore, we can bring it back on top of any other
	   window with the focus() method. There would be no need to re-create
	   the window or to reload the referenced resource. */
  };
}

