<!-- OPEN WINDOW ----------- -->

function OpenWindow(refURL,refTitle,refWidth,refHeight) {
  window.open(refURL,refTitle,"width="+refWidth+",height="+refHeight+",location=0,menubar=0,resizable=0,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=40,screeny=40,left=40,top=40");
}

function OpenPlain(refURL,refTitle,refWidth,refHeight) {
  window.open(refURL,refTitle,"width="+refWidth+",height="+refHeight+",location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=40,screeny=40,left=40,top=40");
}

function OpenRegular(refURL,refTitle,refWidth,refHeight) {
  window.open(refURL,refTitle,"width="+refWidth+",height="+refHeight+",location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=1,toolbar=0,hotkeys=0,screenx=40,screeny=40,left=40,top=40");
}

function CreateWindow(refURL) {
  OpenWindow(refURL,'Information',375,400);
}

function OnMouse(imgLocation,imgName) {
  imgDir = "images/"
  if(document.images) {
    document.images[eval(imgLocation+imgName)].src = imgDir + "image-" + imgLocation + "-dn.gif";
  }
}

function OffMouse(imgLocation,imgName) {
  if(document.images) {
    document.images[eval(imgLocation+imgName)].src = imgDir + "image-" + imgLocation + ".gif";
  }
}

function getShareUrlEmail(url, text) {
  document.location = 'mailto:?subject=' + unescape(escape(text)) + '&body=' + unescape(escape(text)) + escape('\n\n' + url) + escape('\n\n' + 'Greek Music & Video Downloading is now Legal @ mpGreek.com');
}
   
function confirmDelete(jsText) {
  var agree=confirm(jsText);
  if (agree)
	return true ;
  else
	return false ;
}

function addMPOD_Album(jsAlbum,jsText) {
  document.all.processRequest.src="/mpod/mpod.asp?Action=AddAlbum&productnum="+jsAlbum
  alert(jsText);
  return false;
}

function addMPOD_Song(jsAlbum,jsSong,jsText) {
  document.all.processRequest.src="/mpod/mpod.asp?Action=Add&productnum="+jsAlbum+"&songnum="+jsSong
  alert(jsText);
  return false;
}

function addSong_Cart(jsAlbum,jsSong,jsText) {
  document.all.processRequest.src="/help/vcart.asp?Action=Add&productnum="+jsAlbum+"&songnum="+jsSong+"&step=y"
  alert(jsText);
  return false;
}

function addVideo_Cart(jsAlbum,jsSong,jsText) {
  document.all.processRequest.src="/help/vcart.asp?Action=AddVideo&productnum="+jsAlbum+"&songnum="+jsSong+"&step=y"
  alert(jsText);
  return false ;
}

function addAlbum_Cart(jsAlbum,jsText) {
  document.all.processRequest.src="/help/vcart.asp?Action=Add&productnum="+jsAlbum+"&songnum=ALBUM&step=y"
  alert(jsText);
  return false ;
}

function addBundle_Cart(jsAlbum,jsText) {
  document.all.processRequest.src="/help/vcart.asp?Action=Add&productnum="+jsAlbum+"&songnum=ALL&step=y"
  alert(jsText);
  return false ;
}

function addMultiple_Cart(jsAlbum,jsText) {
  document.all.processRequest.src="/help/vcart.asp?Action=Add&multiple="+jsAlbum+"&step=y"
  alert(jsText);
  return false ;
}

function addSong_Cartv5(jsAlbum,jsSong,jsText) {
  top.location = "/vcartv5.asp?Action=Add&productnum="+jsAlbum+"&songnum="+jsSong;
  return false;
}

function addVideo_Cartv5(jsAlbum,jsSong,jsText) {
  top.location = "/vcartv5.asp?Action=AddVideo&productnum="+jsAlbum+"&songnum="+jsSong;
  return false ;
}

function addAlbum_Cartv5(jsAlbum,jsText) {
  top.location = "/vcartv5.asp?Action=Add&productnum="+jsAlbum+"&songnum=ALBUM";
  return false ;
}

function addBundle_Cartv5(jsAlbum,jsText) {
  top.location = "/vcartv5.asp?Action=Add&productnum="+jsAlbum+"&songnum=ALL";
  return false ;
}

function addMultiple_Cartv5(jsAlbum,jsText) {
  top.location = "/vcartv5.asp?Action=Add&multiple="+jsAlbum; 
  return false ;
}

function showARROW_Home(jsSelect){
  showSONGS.innerHTML = ""
  showALBUMS.innerHTML = ""
  showCOMPILE.innerHTML = ""
  showSUGGEST.innerHTML = ""
  showRINGS.innerHTML = ""
  jsSelect.innerHTML = "<img src='/images/icon_down_over.gif'>" 
  return true;
}

function show_Home(jsSelect,jsSelectIcon) {
  document.all.panelLoading.style.visibility="hidden";
  document.all.panelSongs.style.visibility="hidden";
  document.all.panelAlbums.style.visibility="hidden";
  document.all.panelArtists.style.visibility="hidden";
  document.all.panelCompile.style.visibility="hidden";
  document.all.panelSuggest.style.visibility="hidden";
  if (document.all.panelRingtones != null) {
    document.all.panelRingtones.style.visibility="hidden";
  }  
  document.all.showSONGS.innerHTML = ""
  document.all.showALBUMS.innerHTML = ""
  document.all.showARTISTS.innerHTML = ""
  document.all.showCOMPILE.innerHTML = ""
  document.all.showSUGGEST.innerHTML = ""
  if (document.all.showRINGS != null) {
    document.all.showRINGS.innerHTML = ""
  }  
  jsSelectIcon.innerHTML = "<img src='/images/icon_down_over.gif'>" 
  jsSelect.style.visibility = "visible"; 
}

function show_HomePanel(jsSelect,jsSelectIcon,jsTop,jsLeft) {
  if (document.all.panelSongs != null) {
    document.all.panelSongs.style.visibility="hidden";
  }
  if (document.all.panelAlbums != null) {
    document.all.panelAlbums.style.visibility="hidden";
  }
  if (document.all.panelArtists != null) {
    document.all.panelArtists.style.visibility="hidden";
  }
  if (document.all.panelCompile != null) {  
    document.all.panelCompile.style.visibility="hidden";
  }
  if (document.all.panelSuggest != null) {  
    document.all.panelSuggest.style.visibility="hidden";
  }  
  if (document.all.panelRingtones != null) {
    document.all.panelRingtones.style.visibility="hidden";
  }  
  document.all.showSONGS.innerHTML = ""
  document.all.showALBUMS.innerHTML = ""
  document.all.showARTISTS.innerHTML = ""
  document.all.showCOMPILE.innerHTML = ""
  document.all.showSUGGEST.innerHTML = ""
  if (document.all.showRINGS != null) {
    document.all.showRINGS.innerHTML = ""
  }  
  jsSelect.style.top = jsTop + 'px';
  jsSelect.style.left = jsLeft + 'px';
  jsSelectIcon.innerHTML = "<img src='/images/icon_down_over.gif'>" 
  jsSelect.style.visibility = "visible"; 
}

function getSongPlay(jsProduct,jsTrack) {
  var browserName=navigator.appName; 
  if (browserName=="Microsoft Internet Explorer") {
     //OpenPlain("/mpod/mpodv4full.asp?Play=PLAYSONG&Content="+jsProduct+":"+jsTrack,"mPOD",615,528);
     window.location = "/product_details.asp?sku="+jsProduct+"&play="+jsTrack;
  }
  else {
     window.location = "/product_details.asp?sku="+jsProduct+"&play="+jsTrack;
     //OpenPlain('/mpod/player_small.asp?ID='+jsProduct+'&NM='+jsTrack,'mpGreek_Clip',288,232)
  }
  return false;
}

function getRadioPlay() {
  window.location = "/mpod/mpodv5full.asp?Play=FREE_DOWN";
  //OpenPlain("/mpod/mpodv4full.asp?Play=FREE_DOWN","mPOD",615,528);  
  return false;
}

function getPlaylistPlay(jsChannel) {
  window.location = "/mpod/mpodv5full.asp?Play="+jsChannel;
  //OpenPlain("/mpod/mpodv4full.asp?Play="+jsChannel,"mPOD",615,528);  
  return false;
}

function show_DialogPlayer(jsSelect,jsPlay)
{
  jsSelect.style.left = gMouseX-35;
  jsSelect.style.top = gMouseY+8;
  jsSelect.style.visibility = "visible";
  document.getElementById('playerLayer').url = jsPlay;
  show_Dialog(jsSelect);
}

function hide_DialogPlayer(jsSelect)
{
  document.getElementById('playerLayer').stop;
  document.getElementById('playerLayer').url = '';
  hide_Dialog(jsSelect);
  //jsSelect.style.visibility = "hidden"; 
  //jsSelect.style.left = 0;
  //jsSelect.style.top = 0;
}

function show_Dialog(jsSelect){
  if (jsSelect.style.left=="0px" || jsSelect.style.left=="0pt") {
    jsSelect.style.left = gMouseX-58;
    jsSelect.style.top = gMouseY+5;
    jsSelect.style.visibility = "visible"; 
  }
  ie5 = (navigator.appName.indexOf('Microsoft') != -1)
  //ie5 = (document.all && document.getElementById);
  if (ie5) {
	  opac = jsSelect.filters.alpha.opacity; 
  } 
  else {   
	  opac = jsSelect.style.MozOpacity*100;
  }
  if(opac<100){ 
		opac+=20; 
		if (ie5) {
		  jsSelect.filters.alpha.opacity = opac; 
		} 
		else {   
		  jsSelect.style.MozOpacity = opac/100; 
		}  
		setTimeout("show_Dialog(document.getElementById('"+jsSelect.id+"'))", 35); 
  } 
}

function show_DialogCenter(jsSelect,jsSize){
  var screenW = screen.width, screenH = screen.height;
  if (jsSelect.style.left=="0px" || jsSelect.style.left=="0pt") {
    jsSelect.style.left = ((screenW-jsSize)/2)-9;
    jsSelect.style.top = 325;
    jsSelect.style.visibility = "visible"; 
  }
  ie5 = (navigator.appName.indexOf('Microsoft') != -1)
  //ie5 = (document.all && document.getElementById); 
  if (ie5) {
	  opac = jsSelect.filters.alpha.opacity; 
  } 
  else {   
	  opac = jsSelect.style.MozOpacity*100;
  }
  if(opac<100){ 
		opac+=20; 
		if (ie5) {
		  jsSelect.filters.alpha.opacity = opac; 
		} 
		else {   
		  jsSelect.style.MozOpacity = opac/100; 
		}  
		setTimeout("show_Dialog(document.getElementById('"+jsSelect.id+"'))", 35); 
  } 
}

function show_Dialog1(jsSelect){
  if (jsSelect.style.left == "0px" || jsSelect.style.left=="0pt") {
    jsSelect.style.left = gMouseX-58;
    jsSelect.style.top = gMouseY-135;
    jsSelect.style.visibility = "visible"; 
  }
  ie5 = (document.all && document.getElementById); 
  if (ie5) {
	  opac = jsSelect.filters.alpha.opacity; 
  } 
  else {   
	  opac = jsSelect.style.MozOpacity*100;
  }
  if(opac<100){ 
		opac+=20; 
		if (ie5) {
		  jsSelect.filters.alpha.opacity = opac; 
		} 
		else {   
		  jsSelect.style.MozOpacity = opac/100; 
		}  
		setTimeout("show_Dialog1(document.getElementById('"+jsSelect.id+"'))", 35); 
  } 
}

function hide_Dialog(jsSelect){
  ie5 = (document.all && document.getElementById); 
  if (ie5) {
	  opac = jsSelect.filters.alpha.opacity; 
  } 
  else {   
	  opac = jsSelect.style.MozOpacity*100;
  }
  if(opac>0){ 
		opac-=20; 
		if (ie5) { 
		  jsSelect.filters.alpha.opacity = opac; 
		}
		else {  
          jsSelect.style.MozOpacity = opac/100; 
        }  
		setTimeout("hide_Dialog(document.getElementById('"+jsSelect.id+"'))", 35); 
  }
  else { 
    jsSelect.style.visibility = "hidden"; 
    jsSelect.style.left = 0;
    jsSelect.style.top = 0;  
  }  
}

function addVOTE_Song(jsAlbum,jsSong,jsValue,jsText) {
  document.all.processRequest.src="/cgi-bin/process.asp?a=vote&rate="+jsValue+"&product="+jsAlbum+"&song="+jsSong
  alert(jsText);
  return false;
}

function addVOTE_Album(jsAlbum,jsValue,jsText) {
  document.all.processRequest.src="/cgi-bin/process.asp?a=vote&rate="+jsValue+"&product="+jsAlbum
  alert(jsText);
  return false;
}

function addVOTE_User(jsAlbum,jsValue,jsText) {
  document.all.processRequest.src="/cgi-bin/process.asp?a=vote&rate="+jsValue+"&user="+jsAlbum
  alert(jsText);
  return false;
}

function addVOTE_Content(jsAlbum,jsValue,jsText) {
  document.all.processRequest.src="/cgi-bin/process.asp?a=vote&rate="+jsValue+"&usercontent="+jsAlbum
  alert(jsText);
  return false;
}

function addVOTE_Artist(jsArtist,jsValue,jsText) {
  document.all.processRequest.src="/cgi-bin/process.asp?a=vote&rate="+jsValue+"&artist="+jsArtist
  alert(jsText);
  return false;
}

function nav_opener(link){
  var op = new String(window.opener.location);
  if (op.indexOf("www.mpgreek.com")>-1 || op.indexOf("www.musicnow.gr")>-1) {
    window.opener.location.href = link.href;
    return false;
  }
  else {
    return true;
  }
}

function setCookie(name, value, secure)
{
  var now = new Date();
  var days_till_expire = 30;
  var path = "/";
  var domain = "mpgreek.com";

  var expires_at = null;
  if ( days_till_expire )
  {
    expires_at = new Date();
    expires_at.setTime(now.getTime() + ((days_till_expire * 24 * 60 * 60 + 20) * 1000));
    expires_at_str = expires_at.toGMTString();
  }

  var cookie_value = name + "=" + value +
        ((expires_at) ? "; expires=" + expires_at_str : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
  document.cookie = cookie_value;
}

function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    var value = unescape(dc.substring(begin + prefix.length, end));
    return value;
}

// current X-position of the mouse
var gMouseX = 0;

// current Y-position of the mouse
var gMouseY = 0;


// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var mousePosIE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!mousePosIE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var mousePosTempX = 0
var mousePosTempY = 0

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  if (mousePosIE) { // grab the x-y pos.s if browser is IE
    mousePosTempX = event.clientX + document.body.scrollLeft
    mousePosTempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    mousePosTempX = e.pageX
    mousePosTempY = e.pageY
  }
  // catch possible negative values in NS4
  if (mousePosTempX < 0){mousePosTempX = 0}
  if (mousePosTempY < 0){mousePosTempY = 0}
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  gMouseX = mousePosTempX
  gMouseY = mousePosTempY
  return true
}

var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
  this.pausecheck=pause
  this.mouseovercheck=0
  this.delay=delay
  this.degree=10 //initial opacity degree (10%)
  this.curimageindex=0
  this.nextimageindex=1
  fadearray[fadearray.length]=this
  this.slideshowid=fadearray.length-1
  this.canvasbase="canvas"+this.slideshowid
  this.curcanvas=this.canvasbase+"_0"
  if (typeof displayorder!="undefined")
  theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
  this.theimages=theimages
  this.imageborder=parseInt(borderwidth)
  this.postimages=new Array() //preload images
  for (p=0;p<theimages.length;p++){
  this.postimages[p]=new Image()
  this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
  document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
else
  document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
  this.startit()
else{
  this.curimageindex++
  setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
 if (obj.degree<100){
 obj.degree+=5
 if (obj.tempobj.filters&&obj.tempobj.filters[0]){
 if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
 obj.tempobj.filters[0].opacity=obj.degree
 else //else if IE5.5-
 obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
 obj.tempobj.style.MozOpacity=obj.degree/101
 else if (obj.tempobj.style.KhtmlOpacity)
 obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
 clearInterval(fadeclear[obj.slideshowid])
 obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
 obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
 obj.populateslide(obj.tempobj, obj.nextimageindex)
 obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
 setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
 var slideHTML=""
 if (this.theimages[picindex][1]!="") //if associated link exists for image
 slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
 slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
 if (this.theimages[picindex][1]!="") //if associated link exists for image
 slideHTML+='</a>'
 picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
 if (this.pausecheck==1) //if pause onMouseover enabled, cache object
 var cacheobj=this
 if (this.mouseovercheck==1)
 setTimeout(function(){cacheobj.rotateimage()}, 100)
 else if (iebrowser&&dom||dom){
 this.resetit()
 var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
 crossobj.style.zIndex++
 fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
 this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
 var ns4imgobj=document.images['defaultslide'+this.slideshowid]
 ns4imgobj.src=this.postimages[this.curimageindex].src
}
 this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
 this.degree=10
 var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
 if (crossobj.filters&&crossobj.filters[0]){
 if (typeof crossobj.filters[0].opacity=="number") //if IE6+
 crossobj.filters(0).opacity=this.degree
 else //else if IE5.5-
 crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
 crossobj.style.MozOpacity=this.degree/101
 else if (crossobj.style.KhtmlOpacity)
 crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function(){
 var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
 this.populateslide(crossobj, this.curimageindex)
 if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
 var cacheobj=this
 var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
 crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
 crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
 this.rotateimage()
}

// Helper function to find the main album image's horizontal position (currently not used)
function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent)
    {
      while (obj.offsetParent)
      {
        curleft += obj.offsetLeft
        obj = obj.offsetParent;
      }
    }
    else if (obj.x)
      curleft += obj.x;
    return curleft;
}

// Helper function to find the main album image's horizontal position (currently not used)
function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent)
    {
      while (obj.offsetParent)
      {
        curtop += obj.offsetTop
        obj = obj.offsetParent;
      }
    }
    else if (obj.y)
      curtop += obj.y;
    return curtop;
}
// end hiding script -->
