// JavaScript Document
// JScript File
var isMozilla;
var objDiv = null;
var originalDivHTML = "";
var DivID = "";
var over = false;

function buildDimmerDiv()
{
   
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	//var docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight
	//var docwidthcomplete=(standardbody.offsetWidth>standardbody.scrollWidth)? standardbody.offsetWidth : standardbody.scrollWidth
	
    document.write('<div id="dimmer"  class="dimmer" style="visibility:hidden;display:none"></div>');
	
}


 function displayCommon_first(divid)
	    {  
	        var w, h, l, t;
	        w = 700;
	        h = 300;
	        l = screen.width/4;
	        t = screen.height/2;
	        displayFloatingDiv_first(divid, 'Payment', w, h, l, t);
        	
	    }

function displayFloatingDiv_first(divId, title, width, height, left, top) 
{
	//alert("00000000");
	var left_side;
    originalDivHTML='';
	DivID = divId;
	
	document.getElementById(divId).style.visibility = "visible";
	document.getElementById(divId).style.display = "block";
	document.getElementById(divId).focus();
    document.getElementById(divId).style.width = 935 + 'px';
    if (navigator.appName == "Microsoft Internet Explorer")
	{
        document.getElementById(divId).style.top = parseInt(document.body.scrollTop + screen.height/3 ) + 'px';
	    document.getElementById(divId).style.left =parseInt(document.body.scrollLeft + (screen.width/4))  + 'px';	    
		left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		left_side = (left_side/2);
	}
	else
	{
		//alert(window.pageYOffset);
		//alert(window.pageYOffset);
		left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		left_side = (left_side/2);
	    document.getElementById(divId).style.top = parseInt(window.pageYOffset + screen.height/3) + 'px';
	    document.getElementById(divId).style.left =parseInt(window.pageXOffset + (screen.width/4))  + 'px';
		//alert(document.getElementById(divId).style.top);
		//alert(document.getElementById(divId).style.left);
	}
	document.getElementById(divId).style.left = left_side + 'px';
	
	//
	document.getElementById(divId).style.top = 100 + 'px';
	//alert(document.getElementById(divId).style.left);
	//alert(document.getElementById(divId).style.top);
	
	
	var addHeader;
	if (originalDivHTML == "")
	    originalDivHTML = document.getElementById(divId).innerHTML;
		
	addHeader = '<table style="width:' + width + 'px" class="floatingHeader">' +
	            '<tr><td ondblclick="void(0);" onmouseover="over=true;" onmouseout="over=false;" style="cursor:move;height:18px">' + title + '</td>' + 
	            '<td style="width:18px" align="right"></td></tr></table>';
			
    // add to your div an header	
	document.getElementById(divId).innerHTML = originalDivHTML;
	document.getElementById(divId).className = 'dimming';
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	var docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight
	var docwidthcomplete=(standardbody.offsetWidth>standardbody.scrollWidth)? standardbody.offsetWidth : standardbody.scrollWidth
	document.getElementById('dimmer').style.visibility = "visible";
	document.getElementById('dimmer').style.display = "block";
	document.getElementById('dimmer').style.width = docwidthcomplete + 'px';
    document.getElementById('dimmer').style.height = docheightcomplete + 'px';
	
    //////dropdown
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) 
	{
	    if(selects[i].className!="billing_countryid1")
	    {
	        selects[i].disabled=true;
			selects[i].style.visibility = "hidden";
	    }
	}
	

}
function displayFloatingDiv_first_shopping(divId, title, width, height, left, top) 
{
	//alert("00000000");
   var left_side;
    originalDivHTML='';
	DivID = divId;
	
	document.getElementById(divId).style.visibility = "visible";
	document.getElementById(divId).style.display = "block";
	document.getElementById(divId).focus();
    document.getElementById(divId).style.width = 935 + 'px';
    if (navigator.appName == "Microsoft Internet Explorer")
	{
        document.getElementById(divId).style.top = parseInt(document.body.scrollTop + screen.height/3 ) + 'px';
	    document.getElementById(divId).style.left =parseInt(document.body.scrollLeft + (screen.width/4))  + 'px';	    
		left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		left_side = (left_side/2);
	}
	else
	{
		//alert(window.pageYOffset);
		//alert(window.pageYOffset);
		left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		left_side = (left_side/2);
	    document.getElementById(divId).style.top = parseInt(window.pageYOffset + screen.height/3) + 'px';
	    document.getElementById(divId).style.left =parseInt(window.pageXOffset + (screen.width/4))  + 'px';
		//alert(document.getElementById(divId).style.top);
		//alert(document.getElementById(divId).style.left);
	}
	document.getElementById(divId).style.left = left_side + 'px';
	
	//
	document.getElementById(divId).style.top = 100 + 'px';
	//alert(document.getElementById(divId).style.left);
	//alert(document.getElementById(divId).style.top);
	
	
	var addHeader;
	if (originalDivHTML == "")
	    originalDivHTML = document.getElementById(divId).innerHTML;
		
	addHeader = '<table style="width:' + width + 'px" class="floatingHeader">' +
	            '<tr><td ondblclick="void(0);" onmouseover="over=true;" onmouseout="over=false;" style="cursor:move;height:18px">' + title + '</td>' + 
	            '<td style="width:18px" align="right"></td></tr></table>';
			
    // add to your div an header	
	document.getElementById(divId).innerHTML = originalDivHTML;
	document.getElementById(divId).className = 'dimming';
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	var docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight
	var docwidthcomplete=(standardbody.offsetWidth>standardbody.scrollWidth)? standardbody.offsetWidth : standardbody.scrollWidth
	document.getElementById('dimmer').style.visibility = "visible";
	document.getElementById('dimmer').style.display = "block";
	document.getElementById('dimmer').style.width = docwidthcomplete + 'px';
    document.getElementById('dimmer').style.height = docheightcomplete + 'px';
	
    //////dropdown
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) 
	{
	    if(selects[i].className!="billing_countryid1")
	    {
	        selects[i].disabled=true;
			selects[i].style.visibility = "hidden";
	    }
	}
	

}
function displayFloatingDiv_emailthispdf(divId, title, width, height, left, top) 
{
	//alert("00000000");
   var left_side;
    originalDivHTML='';
	DivID = divId;
	
	document.getElementById(divId).style.visibility = "visible";
	document.getElementById(divId).style.display = "block";
	document.getElementById(divId).focus();
    document.getElementById(divId).style.width = 410 + 'px';
    if (navigator.appName == "Microsoft Internet Explorer")
	{
		var topDiff = (screen.height-document.body.scrollTop)/4;
		//alert(screen.height+" === "+document.body.scrollTop+" === "+topDiff);
        document.getElementById(divId).style.top = parseInt(document.body.scrollTop + topDiff ) + 'px';
		left_side = parseInt((screen.width/2) - document.body.scrollLeft - 205);	
		if(left_side < 1)	{
			left_side = 10;
		}
	    document.getElementById(divId).style.left = left_side  + 'px';	
		//left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		//left_side = (left_side/2);
	}
	else
	{
		//alert(window.pageYOffset);
		//alert(window.pageYOffset);
		left_side = (screen.width-document.getElementById(divId).style.width.replace("px",""));
		left_side = (left_side/2);
		var topDiff = ((screen.height-window.pageYOffset)/3)-100;
	    document.getElementById(divId).style.top = parseInt(window.pageYOffset + topDiff) + 'px';
	    left_side =parseInt((screen.width/2) - (window.pageXOffset) - 205);	
		if(left_side < 1)	{
			left_side = 10;
		}
	    document.getElementById(divId).style.left = left_side  + 'px';	
		//alert(document.getElementById(divId).style.top);
		//alert(document.getElementById(divId).style.left);
	}
	//if(divId=='showloginpaneldiv'){
	//document.getElementById(divId).style.left = '40%';
	//document.getElementById(divId).style.top = '35%';}
	//else{
	//document.getElementById(divId).style.left = left_side + 'px';
	//document.getElementById(divId).style.top = 100 + 'px';}
	
	
	var addHeader;
	if (originalDivHTML == "")
	    originalDivHTML = document.getElementById(divId).innerHTML;
		
	addHeader = '<table style="width:' + width + 'px" class="floatingHeader">' +
	            '<tr><td ondblclick="void(0);" onmouseover="over=true;" onmouseout="over=false;" style="cursor:move;height:18px">' + title + '</td>' + 
	            '<td style="width:18px" align="right"></td></tr></table>';
			
    // add to your div an header	
	document.getElementById(divId).innerHTML = originalDivHTML;
	document.getElementById(divId).className = 'dimming';
	var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
	var docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight
	//var docwidthcomplete=(standardbody.offsetWidth>standardbody.scrollWidth)? standardbody.offsetWidth : standardbody.scrollWidth
	var docwidthcomplete=standardbody.scrollWidth;
	document.getElementById('dimmer').style.visibility = "visible";
	document.getElementById('dimmer').style.display = "block";
	document.getElementById('dimmer').style.width = docwidthcomplete + 'px';
    document.getElementById('dimmer').style.height = docheightcomplete + 'px';
	
    //////dropdown
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) 
	{
	    if(selects[i].className!="billing_countryid1")
	    {
	        selects[i].disabled=true;
			selects[i].style.visibility = "hidden";
	    }
	}
}

function hiddenFloatingDiv_first(divId) 
{
	document.getElementById(divId).innerHTML = originalDivHTML;
	document.getElementById(divId).style.visibility='hidden';
	document.getElementById(divId).style.display='none';
	document.getElementById('dimmer').style.visibility = 'hidden';
	document.getElementById('dimmer').style.display = 'none';
	
	DivID = "";
	
	//////dropdown
	selects = document.getElementsByTagName("select");
	for (i = 0; i != selects.length; i++) 
	{
		selects[i].disabled=false;
		selects[i].style.visibility = "visible";
	}
}

//
//
//
function MouseDown(e) 
{
    if (over)
    {
        if (isMozilla) {
            objDiv = document.getElementById(DivID);
            X = e.layerX;
            Y = e.layerY;
            return false;
        }

        else {
            objDiv = document.getElementById(DivID);
            objDiv = objDiv.style;
            X = event.offsetX;
            Y = event.offsetY;
        }
    }
}


//
//
//
function MouseMove(e) 
{
    if (objDiv) {
        if (isMozilla) 
        {
            objDiv.style.top = (e.pageY-Y) + 'px';
            objDiv.style.left = (e.pageX-X) + 'px';            
            return false;
        }
        else 
        {
            objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
            objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
            return false;
        }
    }
}
function MouseUp() 
{
    objDiv = null;
}

function init()
{
    // check browser
    isMozilla = (document.all) ? 0 : 1;


    if (isMozilla) 
    {
        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
    }

    document.onmousedown = MouseDown;
    document.onmousemove = MouseMove;
    document.onmouseup = MouseUp;

    // add the div
    // used to dim the page
    
	
 buildDimmerDiv();
  
}


// call init
init();

