// Only need to give first three params

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com
//For IE
var message="";

//Get Page/Script name...
var sPath = window.location.pathname;
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

if (sPage == "thankyou.asp" || sPage == "error.asp" || sPage == "message.asp")
{
    //Do nothing
}
    else
    {
        function clickIE()
        {
            if (document.all)
            {
                (message);
                return false;
            }
        }

        function clickNS(e)
        {
        if (document.layers||(document.getElementById&&!document.all))
            {
                if (e.which==2||e.which==3)
                {
                    (message);
                    return false;
                }
            }
        }

        if (document.layers) 
        {
            document.captureEvents(Event.MOUSEDOWN);
            document.onmousedown=clickNS;
        }
        else
        {
            document.onmouseup=clickNS;
            document.oncontextmenu=clickIE;
        }

        document.oncontextmenu=new Function("return false")
    }


/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
	target.style.MozUserSelect="none"
else //All other route (ie: Opera)
	target.onmousedown=function(){return false}
    target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.body) //Disable text selection on entire body : Commented Out This Line.
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"

function openwin(theURL,winName,features)
{ 
  window.open(theURL,winName,features);
}

function setCurrency()
{
	var searchForm = document.getElementById('SearchForm');
	
	// Change action
	searchForm.action = '/currency/set.asp';
	
	//Submit form
	searchForm.submit();	
}

function openCenteredWindow(url, height, width, name, parms)
{
	var left = (screen.width - width)/2;
	var top = (screen.height - height)/2;
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4)
   { 
   		if (win)
		{
			win.window.focus();
		}
   }
   return win;
}

function disablecopytext()
{
    if (event.srcElement.tagName != 'INPUT') //&& event.srcElement.tagName!='IMG'
	{
		window.event.returnvalue=false
	}
}

function disablerightclick()
{
    alert(event.which.toString());
    
	if (event.button == 2)
	{
	  // do nothing
	}
	if (navigator.appName != 'Microsoft Internet Explorer' && e.which == 3) {
	    // do nothing
	}
}
function disablePictureRightclick()
{
	if (event.button == 2)
	{
	  // do nothing
	  alert('Images are copyright of Myanmardotcom Ltd.');
	  return false;
	}
}
function disablesaveas()
{	
	if(document.images)
    {
    	for(i=0;i<document.images.length;i++)
        {
            document.images[i].onmousedown = right;
            document.images[i].onmouseup = right;
        }
    }
}
//__________________________________________________________
function buttonalert(event) {
    var button;
    if (event.which == null)
        button = (event.button < 2) ? "LEFT" :
                 ((event.button == 4) ? "MIDDLE" : "RIGHT");
    else
        button = (event.which < 2) ? "LEFT" :
                 ((event.which == 2) ? "MIDDLE" : "RIGHT");

    if (button == "RIGHT" && navigator.appName != 'Microsoft Internet Explorer') {
        alert("FireFox is the best browser!");
        //return true;
        dont(event);
    }
    
}
function dont(event) {
    if (event.preventDefault)
        event.preventDefault();
    else
        event.returnValue = false;
    return false;
}
//__________________________________________________________



function right(e)
{
	if (navigator.appName == 'Netscape' && e.which == 3)
	{
	   alert('Images are copyright of Myanmardotcom Ltd.');
	   return false;
    }
    if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2)
	{
       alert('Images are copyright of Myanmardotcom Ltd.');
	   return false;
	}
	else return true;
}

function ExpendImgByHeight(obj, height) {
    //obj.width = width;
    obj.height = height;
    obj.border.width = 18;
    obj.border.color = "#c0c0c0";
}

function ResizeImgByHeight(obj, height) {
    //alert('Images are copyright of Myanmardotcom Ltd.');
     curtop = obj.height = height;
    //obj.height = height;
}


function ExpendImgByWidth(obj, width) {
    obj.width = width;
    //obj.height = height;
    obj.border.width = 18;
    obj.border.color = "#c0c0c0";
}

function ResizeImgByWidth(obj, width) {
    //alert('Images are copyright of Myanmardotcom Ltd.');
    curtop = obj.width = width;
    //obj.height = height;
}

function OldExpendImgBywidth(obj, width) {
    obj.width = width;
    //obj.height = height;
    obj.border.width = 18;
    obj.border.color = "#c0c0c0";
}

function OldResizeImgBywidth(obj, width) {
    //curtop = obj.height = height;
    //alert('Images are copyright of Myanmardotcom Ltd.');
    curtop = obj.width = width;
    //obj.width = width;
}

function PopupECard(ECardAddr, width, height) {
    var left = (screen.width - width)/2;
    var top = (screen.height - height)/2;
    if (navigator.appName == "Netscape") {
        newwindow=window.open('PPECard.aspx?cid=' + ECardAddr, 'ECard', 'toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,scrollbars=-1,resizable=-1,copyhistory=yes,top=' + (top - 130) + ',left=' + left + ',height=' + (height + 70) + ',width=' + (width + 30) + '');

//        if (window.focus) { newwindow.focus() }
//        return false;

    }
    else 
    {
        newwindow = window.open('PPECard.aspx?cid=' + ECardAddr, 'ECard', 'toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,scrollbars=-1,resizable=-1,copyhistory=yes,top=' + (top - 130) + ',left=' + left + ',height=' + (height + 70) + ',width=' + (width + 30) + '');
//        if (window.focus) { newwindow.focus() }
//        return false;
    }
}

/*--------------------------------------------------------------------------------------------------------------------------------------------------*/
// JK Pop up image viewer script- By JavaScriptKit.com
// Visit JavaScript Kit (http://javascriptkit.com)
// for free JavaScript tutorials and scripts
// This notice must stay intact for use

var popbackground = "black" //specify backcolor or background image for pop window
var windowtitle = "Image Window"  //pop window title

function detectexist(obj) {
    return (typeof obj != "undefined")
}

function jkpopimage(imgpath, popwidth, popheight, textdescription) {

    function getpos() {
        leftpos = (detectexist(window.screenLeft)) ? screenLeft + document.body.clientWidth / 2 - popwidth / 2 : detectexist(window.screenX) ? screenX + innerWidth / 2 - popwidth / 2 : 0
        toppos = (detectexist(window.screenTop)) ? screenTop + document.body.clientHeight / 2 - popheight / 2 : detectexist(window.screenY) ? screenY + innerHeight / 2 - popheight / 2 : 0
        if (window.opera) {
            leftpos -= screenLeft
            toppos -= screenTop
        }
    }

    getpos()
    var winattributes = 'width=' + popwidth + ',height=' + popheight + ',resizable=yes,left=' + leftpos + ',top=' + toppos
    var bodyattribute = (popbackground.indexOf(".") != -1) ? 'background="' + popbackground + '"' : 'bgcolor="' + popbackground + '"'
    if (typeof jkpopwin == "undefined" || jkpopwin.closed)
        jkpopwin = window.open("", "", winattributes)
    else {
        //getpos() //uncomment these 2 lines if you wish subsequent popups to be centered too
        //jkpopwin.moveTo(leftpos, toppos)
        jkpopwin.resizeTo(popwidth, popheight + 30)
    }
    jkpopwin.document.open()
    jkpopwin.document.write('<html><title>' + windowtitle + '</title><body ' + bodyattribute + '><img src="' + imgpath + '" style="margin-bottom: 0.5em"><br />' + textdescription + '</body></html>')
    jkpopwin.document.close()
    jkpopwin.focus()
}


/*--------------------------------------------------------------------------------------------------------------------------------------------------*/

function SendMessage(ECardAddr, width, height) {
    var left = (screen.width - width) / 2;
    var top = (screen.height - height) / 2;
    if (navigator.appName == "Netscape") {
        //window.open('http://localhost:59585/NMDC/NMDCFSSendMail.aspx', 'ECard', 'toolbar=no,titlebar=no,location=NO,directories=no,status=no,menubar=no,scrollbars=YES,resizable=no,copyhistory=yes,top=' + (top - 130) + ',left=' + left + ',height=' + (height + 195) + ',width=' + (width + 70) + '');
        window.open('http://localhost:59585/NMDC/NMDCFSSendMail.aspx', 'ECard', 'chrome, centerscreen, dependent= YES, dialog=YES, modal= YES, resizable= NO, scrollbars= NO, location= 0, status= 0, menubar= 0, toolbar= 0, copyhistory= yes, top= ' + (top - 130) + ',left=' + left + ',height=' + (height + 195) + ',width=' + (width + 70) + '');
        window.focus();
    }
    else {
        window.open('http://localhost:59585/NMDC/NMDCFSSendMail.aspx', 'ECard', 'chrome, centerscreen, dependent= YES, dialog=YES, modal= YES, resizable= NO, scrollbars= NO, location= 0, status= 0, menubar= 0, toolbar= 0, copyhistory= yes, top= ' + (top - 130) + ',left=' + left + ',height=' + (height + 195) + ',width=' + (width + 70) + '');
    }
}


