
var uploadedid = -1;

function addPhoto(){
var myurl = top.photowarsframe.location.href;

if (myurl.indexOf('photos/add/') >= 0)
 { $("#viral_widget_cntr").hide(); }
}


function thankYou(){
var myurl = top.photowarsframe.location.href;

if (myurl.indexOf('photos/thankyou/') >= 0)
 { $("#viral_widget_thanks").show(); 
   $("#viral_widget_cntr").hide(); }
else
 { $("#viral_widget_thanks").hide();
   $("#viral_widget_cntr").show(); }
}


function scrollWindowTop(){
    window.scrollTo(0,0);
}
function adjustIFrameSize(iframeWindow) {

  if (iframeWindow.document.height) {
    var iframeElement = document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
	iframeElement.style.width = 622 + 'px';
  }
  else if (document.all) {
    var iframeElement = document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode &&
        iframeWindow.document.compatMode != 'BackCompat') 
    {
		iframeElement.style.height = 
			iframeWindow.document.documentElement.scrollHeight + 5 + 'px';
		iframeElement.style.width = 622 + 'px';
    }
    else {
		iframeElement.style.height = 
			iframeWindow.document.body.scrollHeight + 5 + 'px';
		iframeElement.style.width = 622 + 'px';
    }
  }
  else 
  { 
    var iframeElement = document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.documentElement.offsetHeight + 'px';
	iframeElement.style.width = 622 + 'px';
  }
  
  thankYou();
  addPhoto();   
  
}


function getQueryVariable(variable) 
{  var query = window.location.search.substring(1);
  var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
     var pair = vars[i].split("=");
      if (pair[0] == variable) { 
        return pair[1];    }  }
     }  
$(function() {	 
 if (getQueryVariable('pwurl')){
document.getElementById('photowarsframe').src = getQueryVariable('pwurl');
}
});

function mailpage()
{
var myurl = top.photowarsframe.location.href;
myurl = document.location + "?pwurl=" + myurl;
mail_str = "mailto:?subject=Check out the " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at, " + myurl;
location.href = mail_str;
}