var head="display:''";

function doit(header) {
	var head=header.style;
	if (head.display=="none") {
		head.display="";
	}
	else {
		head.display="none";
	}
}

function ShowPopup(Path,PopupOffer) {
	if (document.all) {
		window.open(Path+'PP='+PopupOffer,PopupOffer,'top=50,left=50,status=0,toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0');
	}
}

function ConfirmClickEvent(FormName, ConfirmMessage) {
	ConfirmMessage = window.confirm(ConfirmMessage);
	if (ConfirmMessage) {
		return true;
	}
	else {
		return false;
	}
}

function ConfirmOpen(OpenURL, ConfirmMessage) {
	ConfirmMessage = window.confirm(ConfirmMessage);
	if (ConfirmMessage) {
		window.open(OpenURL);
	}
	else {
		return false;
	}
}

function WindowResizeMaximum() {
	window.moveTo(0, 0)
	window.resizeTo(screen.availWidth, screen.availHeight);
}

function ConfirmRedirect(RedirectURL, ConfirmMessage) {
	ConfirmMessage = window.confirm(ConfirmMessage);
	if (ConfirmMessage) {
		parent.window.location.href = RedirectURL;
	}
	else {
	}
}

function ConfirmSubject(selectedname) {
		if( selectedname == "Technical Support - Lost Serial Number" ) {
				ConfirmRedirect("serialnumberrecover.asp","Did you know that you can use our ONLINE SERIAL NUMBER RECOVER? \nBy doing so, you will get an INSTANT response instead of waiting until Sienzo Support send you the serial number!!");
		}
		if( selectedname == "Technical Support - Need License File" ) {
				ConfirmRedirect("getlicensefile.asp","Did you know that you can use our ONLINE LICENSE FILE CREATOR? \nBy doing so, you will get an INSTANT response instead of waiting until Sienzo Support send you the license file!!");
		}
		if( selectedname == "Partnering - Affiliate Program" ) {
				ConfirmRedirect("affiliate.asp","Did you know that you could join our affiliate program online? \nBy doing so, you will get an INSTANT response instead of waiting until Sienzo Support as processed our inquery!!");
		}
		if( selectedname == "Technical Support - General (Usage)" ) {
				ConfirmRedirect("faq.asp","Did you read the FAQ? \nBy doing so, you will get an INSTANT response instead of waiting until Sienzo Support as processed our inquery!!");
		}
		if( selectedname == "Technical Support - General (Other)" ) {
				ConfirmRedirect("faq.asp","Did you read the FAQ? \nBy doing so, you will get an INSTANT response instead of waiting until Sienzo Support as processed our inquery!!");
		}
}

function recalculateTotals(check) {
		if( check ) {
			document.getElementById('all_total').innerText = '147.95';
			document.getElementById('rebate_total').innerText = '112.95';
			document.getElementById('savings').innerText = '35.00';
			document.getElementById('productname').value = 'DMM+BIAB+Bundle';
		}
		else
		{
			document.getElementById('all_total').innerText = '59.95';
			document.getElementById('rebate_total').innerText = '49.95';
			document.getElementById('savings').innerText = '10.00';
			document.getElementById('productname').value = 'Sienzo+Digital+Music+Mentor';
		}
}

function goPaypal() {
	if( document.getElementById('rebate_total').innerText == '112.95' )
		window.location = "https://www.paypal.com/xclick?business=paypal@sienzo.com&item_name=DMM+BIAB+Bundle&item_number=100001&amount=112.95&no_note=1&currency_code=USD";
	else
		window.location = "https://www.paypal.com/xclick?business=paypal@sienzo.com&item_name=Sienzo+Digital+Music+Mentor&item_number=100001&amount=49.95&no_note=1&currency_code=USD";
}

function openplayer() 
{ 
	window.open('movieplayer.asp','Movie','width=450,height=450,left=100,top=100,screenX=100,screenY=100,resizable=no'); 
	//window.open('movieplayer.asp','Movie','width=450,height=400,resizable=no'); 
} 

function opendownload()
{
	window.open('downloads.asp?file=DMMSetup.exe','Movie','width=250,height=250,left=100,top=100,screenX=100,screenY=100,resizable=no'); 
}

// Example:
// onMouseOver="toolTip('tool tip text here')";
// onMouseOut="toolTip()";
// -or-
// onMouseOver="toolTip('more good stuff', '#FFFF00', 'orange')";
// onMouseOut="toolTip()"; 
var ns4 = document.layers;
var ns6 = document.getElementById && !document.all;
var ie4 = document.all;
offsetX = 0;
offsetY = 20;
var toolTipSTYLE="";
var divStyle = "";
function initToolTips()
{
  if(ns4||ns6||ie4)
  {
    if(ns4) toolTipSTYLE = document.toolTipLayer;
    else if(ns6) toolTipSTYLE = document.getElementById("toolTipLayer").style;
    else if(ie4) toolTipSTYLE = document.all.toolTipLayer.style;
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      toolTipSTYLE.visibility = "visible";
      toolTipSTYLE.display = "none";
    }
    document.onmousemove = getMouseLoc;
  }
}

function toolTip(title, bodytext, fg, bg)
{
  if(toolTip.arguments.length < 1) // hide
  {
    if(ns4) toolTipSTYLE.visibility = "hidden";
    else toolTipSTYLE.display = "none";
  }
  else // show
  {
	toolTipSTYLE.left = mouseLocation.x + offsetX;
  	toolTipSTYLE.top = mouseLocation.y + offsetY;
    if(!fg) fg = "#777777";
    if(!bg) bg = "#FFFFFF";
    var content =
    '<table width="200" border="1" style="border-style:solid" cellpadding="0" cellspacing="0" bordercolor="F4C50E">' +
	  '<tr bgcolor="#F4C50E">' + 
		'<td width="155" class="PmedBold">&nbsp;' + title + '</td>' +
		'<td width="35" class="Pmed"><a href="#" onClick="toolTip();">close</a></td>' +
	  '</tr>' +
	  '<tr align="center" bgcolor="#FFFFFF">' +
		'<td colspan="2"><table width="180" border="0" cellpadding="3"  bgcolor="#FFFFFF">' +
		  '<tr>' +
			'<td align="left" valign="top"><span class="Pmed">' + bodytext + '</span></td>' +
		  '</tr>' +
		'</table></td>' +
	  '</tr>' +
	'</table>';
    if(ns4)
    {
      toolTipSTYLE.document.write(content);
      toolTipSTYLE.document.close();
      toolTipSTYLE.visibility = "visible";
    }
    if(ns6)
    {
      document.getElementById("toolTipLayer").innerHTML = content;
      toolTipSTYLE.display='block'
    }
    if(ie4)
    {
      document.all("toolTipLayer").innerHTML=content;
      toolTipSTYLE.display='block'
    }
  }
}

function showhide(id){ 
    if (document.getElementById){ 
        obj = document.getElementById(id);
        obj.left = mouseLocation.x + offsetX;
        obj.top = mouseLocation.y + offsetY;
        alert(obj.left+","+obj.top); 
        if (obj.style.display == "none"){ 
            obj.style.display = ""; 
        } else { 
            obj.style.display = "none"; 
        } 
    } 
} 

function showDiv(divname)
{
    if(ns4) divStyle = document.divname;
    else if(ns6) divStyle = document.getElementById(divname).style;
    else if(ie4) divStyle = document.all.divname.style;
    alert(divStyle);
    if(ns4) document.captureEvents(Event.MOUSEMOVE);
    else
    {
      divStyle.visibility = "visible";
      divStyle.display = "none";
    }
  if(showDiv.arguments.length < 1) // hide
  {
    if(ns4) divStyle.visibility = "hidden";
    else divStyle.display = "none";
  }
  else // show
  {
    divStyle.left = mouseLocation.x + offsetX;
    divStyle.top = mouseLocation.y + offsetY;
    if(ns4)
    {
      divStyle.visibility = "visible";
    }
    if(ns6)
    {
      divStyle.display='block'
    }
    if(ie4)
    {
      divStyle.display='block'
    }
  }
}

function moveToMouseLoc(e)
{
  if(ns4||ns6)
  {
    x = e.pageX;
    y = e.pageY;
  }
  else
  {
    x = event.x + document.body.scrollLeft;
    y = event.y + document.body.scrollTop;
  }
  toolTipSTYLE.left = x + offsetX;
  toolTipSTYLE.top = y + offsetY;
  return true;
}

/* 
Example:
function test()
{
  if (document.layers) getMouseLoc;     //NS
  else if (document.all) getMouseLoc(); //IE
  alert(mouseLocation.x+","+mouseLocation.y);
}
in the BODY:
<a href="#" onmouseover="test()">test</a>
*/
function Point(x,y) {  this.x = x; this.y = y; }
mouseLocation = new Point(-500,-500);
function getMouseLoc(e)
{
  if(!document.all)  //NS
  {
    mouseLocation.x = e.pageX;
    mouseLocation.y = e.pageY;
  }
  else               //IE
  {
    mouseLocation.x = event.x + document.body.scrollLeft;
    mouseLocation.y = event.y + document.body.scrollTop;
  }
  return true;
}

function getObject( obj ) {

  // step 1
  if ( document.getElementById ) {
    obj = document.getElementById( obj );

  // step 2
  } else if ( document.all ) {
    obj = document.all.item( obj );

  //step 3
  } else {
    obj = null;
  }

  //step 4
  return obj;
  }

function moveObject( obj, e ) {

  // step 1
  var tempX = 0;
  var tempY = 0;
  var offset = 5;
  var objHolder = obj;

  // step 2
  obj = getObject( obj );
  if (obj==null) return;

  // step 3
  if (document.all) {
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  } else {
    tempX = e.pageX;
    tempY = e.pageY;
  }

  // step 4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}

  // step 5
  obj.style.top  = (tempY + offset) + 'px';
  obj.style.left = (tempX + offset) + 'px';

  // step 6
  displayObject( objHolder, true );
  }

  function displayObject( obj, show ) {

  // step 1
  obj = getObject( obj );
  if (obj==null) return;

  // step 2
  obj.style.display = show ? 'block' : 'none';
  obj.style.visibility = show ? 'visible' : 'hidden';
  }


    function closeImageBig() {
        displayObject('divImageBig',false);
        
        document.getElementById('imageBig').src = '/img/ic_loader.gif';
        document.getElementById('imageBigComment').innerHTML = '';
        displayObject('imageBigComment',false);
    }
    
    function showImageBig(url, imagedescription) {
        closeImageBig()
        displayObject('divImageBig',true);
        
        if (imagedescription && imagedescription != '') {
            document.getElementById('imageBigComment').innerHTML = imagedescription;
            displayObject('imageBigComment',true);
        }
        
        var newImage = new Image(); 
        newImage.src = url;
        document.getElementById('imageBig').src = newImage.src;
    }
    
    function select_all(theClickBox) {    
        var numEmails=document.getElementById('num').value;
        for (i = 0; i < numEmails; i++) {
            document.getElementById('email_array_' + i.toString()).checked = theClickBox.checked; 
        }
        getObjectByID('all1').checked = theClickBox.checked;
    }

