﻿
$(document).ready(function() {

// Emo Vote (single.php)
$('.emo-vote').hide();

// Picture Switcher (single.php)
var imgWrapper = $('.slideshow > img');
imgWrapper.hide().filter(':first').show();

$('ul.recentlist li a').mouseover(function () {
if (this.className.indexOf('current') == -1){
imgWrapper.hide();
//imgWrapper.filter(this.hash).fadeIn(50);
imgWrapper.filter(this.rel).fadeIn(20);

$('ul.recentlist li a').removeClass('current');
$(this).addClass('current');
}
var AtnStatus = 'Click now to vote for ' + $(".current").text();
$('#atn_status').text(AtnStatus);

return false;
});

// Picture Slider (Index)
// http://buildinternet.com/2009/03/sliding-boxes-and-captions-with-jquery/
$('.boxgrid.slideright').hover(function(){
$(".cover", this).stop().animate({left:'500px'},{queue:false,duration:100});
}, function() {$(".cover", this).stop().animate({left:'0px'},{queue:false,duration:100});});



// ToolTip (http://www.queness.com/post/92/create-a-simple-cssjavascript-tooltip-with-jquery)
$('a[rel=q_tt]').mouseover(function(e) {
var tip = $(this).attr('title');
$(this).attr('title','');
$(this).append('<div id="q_tt"><div class="tipBody">' + tip + '</div></div>');
$('#q_tt').css('top', e.pageY + 10 ); $('#q_tt').css('left', e.pageX + 20 );
$('#q_tt').fadeIn('500'); $('#q_tt').fadeTo('10',1);
}).mousemove(function(e) {
$('#q_tt').css('top', e.pageY + 10 ); $('#q_tt').css('left', e.pageX + 20 );
}).mouseout(function() {
$(this).attr('title',$('.tipBody').html()); //Put back the title attribute's value
$(this).children('div#q_tt').remove(); //Remove the appended tooltip template
});



// Sliding over pictures (Single) Start
			$('.slideupcaption').hide();
			$('.slideupwrap', this).hover(function () {
			$('.slideupcaption', this).slideDown(200,'jswing');// jquery.easing: ('jswing')
				},
			function () {
				$('.slideupcaption', this).slideUp(200,'jswing'); // jquery.easing: ('jswing')
			});
// Sliding over pictures (Single) End



}); // ready.function


/////////////////////////////////////////////
/////////////////////////////////////////////

function callflags(AdrFromBody) {$('#theflags').html(geturl(AdrFromBody));}
function geturl(addr) {var r = $.ajax({type: 'GET',url: addr,async: false}).responseText;return r;}

function EffectBlink(element_id){ // add # before
var blinkCount = 4*2;// 2*2 for two blinks, 4*2 for four blinks
do {$(element_id)['fade'+(blinkCount%2==0?'Out':'In')]('slow');} while (--blinkCount);
} // EffectBlink

$(function(){$('#vote-wrapper a').click(function(){
var VoteFor = $(this).attr("votefor");
var PostID = $(this).attr("pid");
var ValThis = "/_helper/validate.php?callflags=1&pid="+PostID+"&votefor="+VoteFor;
callflags(ValThis);
$('#theflags').show();
$('#vote-wrapper').hide();
EffectBlink('#tit_comment');
});});



// Click Tracking
$(function(){$('#clicktrack_gfc a,#singlesamples a').click(function(){$.get($(this).attr("goto"));return true;});});

// Click Tracking v2
$(function(){$('a[linktoaff="socialbookmark"],a[linktoaff="affout"],a[linktoaff="randtradeout"],a[linktoaff="vidz"],a[linktoaff="wfw"],a[linktoaff="motd"],a[linktoaff="vidzidxsb"],a[linktoaff="pictotrade"],a[linktoaff="texttotrade"],a[linktoaff="carolcox"],a[linktoaff="tac"]').click(function(){
var Fetch1 = $(this).attr("linktoaff");
var SaveTo = "http://www.dressed-undressed.com/_helper/validate.php?linktoaff=" + Fetch1;
window.location.href = $(this).attr("href");
$.get(SaveTo); return false;
});});

// Piwik

function GoalVidSeen(obj){
try{
if(obj.state=="COMPLETE(70%)"){
var piwikGoalTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 2);
piwikGoalTracker.trackGoal(7); //Equals your idGoal!
}}catch( err ) {}}

