// JavaScript Document
// Author : alfecaesar

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}


jQuery(document).ready(function(){
/*
  // JOIN TODAY						
  jQuery(".join-us-today a").click(function(){
        var getbool =   jQuery(".join-us-today a").hasClass("link-active");
        if(getbool == true){
        jQuery(".join-us-today a").removeClass("link-active");
	jQuery(".join-pop-up").fadeOut(500);
	jQuery(".join-form").fadeOut(500);
       }else{
        jQuery(".join-us-today a").toggleClass("link-active");
	jQuery(".join-pop-up").fadeIn(500);
	jQuery(".join-form").fadeIn(500);
        }
  });
*/


   // FEATURED LIST
  jQuery("a.h-artist").hover(function(){
           jQuery(".gopop-artist").fadeIn(500);
           jQuery(".gopop-exhibition").fadeOut(500);
           jQuery(".gopop-event").fadeOut(500);
  });
  jQuery("a.h-exhibition").hover(function(){
           jQuery(".gopop-artist").fadeOut(500);
           jQuery(".gopop-exhibition").fadeIn(500);
           jQuery(".gopop-event").fadeOut(500);
  });
  jQuery("a.h-event").hover(function(){
           jQuery(".gopop-artist").fadeOut(500);
           jQuery(".gopop-exhibition").fadeOut(500);
           jQuery(".gopop-event").fadeIn(500);
  });
  
  jQuery(".gopop-artist").bind("mouseleave",function(){
           jQuery(".gopop-artist").fadeOut(500);
  });
  jQuery(".gopop-exhibition").bind("mouseleave",function(){
           jQuery(".gopop-exhibition").fadeOut(500);
  });
  jQuery(".gopop-event").bind("mouseleave",function(){
           jQuery(".gopop-event").fadeOut(500);
  });


// FEATURED ARTIST

var arname = jQuery("#featured_style_artist .feat-name").html();   
var ariama = jQuery("#featured_style_artist .feat-i-am-a").html();  
var ardesc = jQuery("#featured_style_artist .feat-desc").html(); 
var arart = jQuery("#featured_style_artist .feat-artwork").html(); 
var arartname = jQuery("#featured_style_artist .feat-artwork-name").html(); 
// var arlink = jQuery("#featured_style_artist .feat-webappid").html(); 
var arlink = jQuery("#featured_style_artist .artists-gotoprofile a").attr("href"); 
jQuery(".gopop-artist h3").html(arname);
jQuery(".gopop-artist .pop-img div").html(arart);
jQuery(".gopop-artist .pop-img p").html(arartname);         
jQuery(".gopop-artist .pop-cont .pop-cont-txt").html(ariama+"<br />"+ardesc);  
// var arnewname = arname.replace(/ /g, "_");
// jQuery(".gopop-artist .pop-cont .btn-pop a").attr("href","/_webapp_"+arlink+"/"+arnewname);       
jQuery(".gopop-artist .pop-cont .btn-pop a").attr("href",arlink);     


var arname2 = jQuery("#feature_style_exhibition .gall-name").html();   
var ariama2 = jQuery("#feature_style_exhibition .gall-organ").html();  
var ardesc2 = jQuery("#feature_style_exhibition .gall-desc").html(); 
var arart2 = jQuery("#feature_style_exhibition .gall-artimg").html(); 
var arartname2 = jQuery("#feature_style_exhibition .gall-artname").html(); 
// var arlink2 = jQuery("#feature_style_exhibition .gall-id").html(); 
var arlink2 = jQuery("#feature_style_exhibition .artists-gotoprofile a").attr("href"); 
jQuery(".gopop-exhibition h3").html(arname2);
jQuery(".gopop-exhibition .pop-img div").html(arart2);
jQuery(".gopop-exhibition .pop-img p").html(arartname2);         
jQuery(".gopop-exhibition .pop-cont .pop-cont-txt").html(ariama2+"<br />"+ardesc2);  
// var arnewname2 = arname2.replace(/ /g, "_");
// jQuery(".gopop-exhibition .pop-cont .btn-pop a").attr("href","/_webapp_"+arlink2+"/"+arnewname2);  
jQuery(".gopop-exhibition .pop-cont .btn-pop a").attr("href",arlink2);  


var arname3 = jQuery("#whats-on_style_exhibition .og-name").html();   
// var ariama3 = jQuery("#whats-on_style_exhibition .og-label").html();  
var ardesc3 = jQuery("#whats-on_style_exhibition .og-desc").html(); 
var arart3 = jQuery("#whats-on_style_exhibition .og-img").html(); 
var arartname3 = jQuery("#whats-on_style_exhibition .og-name").html(); 
// var arlink3 = jQuery("#whats-on_style_exhibition .og-itemid").html(); 
jQuery(".gopop-event h3").html(arname3);
jQuery(".gopop-event .pop-img div").html(arart3);
jQuery(".gopop-event .pop-img p").html(arartname3);         
// jQuery(".gopop-event .pop-cont .pop-cont-txt").html(ariama3+"<br />"+ardesc3);  
jQuery(".gopop-event .pop-cont .pop-cont-txt").html(ardesc3);  
// var arnewname3 = arname3.replace(/ /g, "_");
// jQuery(".gopop-event .pop-cont .btn-pop a").attr("href","/_webapp_"+arlink3+"/"+arnewname3);  
var linknew01 = "/Featured_Event";
jQuery(".gopop-event .pop-cont .btn-pop a").attr("href",linknew01);  


// END HERE
});



// COMPARE EMAIL
function compareMatch(ele){
var err;
if (document.catwebformform2404.EmailAddress.value !=ele) 
{
   err = "- Email address and its confirmation do not match\n";
return err;
}
else{
  err = "";
return err;
}
}

// COMPARE EMAIL
function compareMatch2(ele){
var err;
if (document.catwebformform33393.EmailAddress.value !=ele) 
{
   err = "- Email address and its confirmation do not match\n";
return err;
}
else{
  err = "";
return err;
}
}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

jQuery.preloadImages("/images/bg_popup_artist.png", "/images/bg_popup_exhibition.png","/images/bg_popup_event.png");
