<!--    //--------- Common JavaScript functions  ------------------


//-->


// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  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;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

function subWindow() {
    if (arguments.length < 1) {
        alert("Error In arguments");
        return null;
    }
    var hval = arguments[1] != null ? arguments[1] : 480;
    var wval = arguments[2] != null ? arguments[2] : 640;
    var fname = arguments[3] != null ? arguments[3] : "";
    var di = "directory=0,height="+hval+",width="+wval+",left=100,top=100,resizable=1,statusbar=0,hotkeys=0,menubar=0,scrollbars=1,status=0,toolbar=0";
    var newWindow = window.open(fname,arguments[0],di);
    if (!fname) {
        newWindow.document.write("<center><font size=4 color='Blue'>Loading Product Image, please wait...</font></center>")
    }
    return;
}
function soon(msg) { alert(msg); }


function swapImage(imgName,imgURL){
	if (imgURL.length>0) {
    		document.images[imgName].src = imgURL;
    	}
}

var isIE;
if(document.all){isIE=true}


function pop(URL,h,w) {
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
		if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "directory=0,HEIGHT=" + h + ",WIDTH=" + w + ",left=30,top=80,resizable=1,statusbar=0,hotkeys=0,menubar=0,scrollbars,status=0,toolbar=0";
	newWin =  window.open(URL,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}

function popResize(URL,h,w) {
	if(isIE){
		if (window.newWin) { window.newWin.close() }
	}else{
if(window.newWin){
			if(window.newWin.closed!=true){
			    window.newWin.close();
			}
		}
	}
	specs = "HEIGHT=" + h + ",WIDTH=" + w + ",toolbar,status,resizable,scrollbars";
	newWin =  window.open(URL,"newWin",specs);
	if (newWin.opener == null) newWin.opener = self;
	newWin.focus();
}

function backtoWin(url) {
    parent.window.opener.location = url ;
    parent.window.opener.focus();
}

function setDeletePaymentId(frmObj,payid) {
    if (frmObj["deletePaymentId"]!=null) {
        frmObj.deletePaymentId.value=payid;			
    }
    return true;
}

function popup(URL,type) {
	if ("small" == type) {
		w = "375";
		h = "335";
	} else if ("large" == type) {
		w = "800";
		h = "600";	
	} else if ("large_long" == type) {
		w = "585";
		h = "600";
	}
	
	pop(URL,h,w);
}
//  End of Common JavaScript Functions       -------->