function xd(id)
{
    document.getElementById('check_' + (id+999)).checked = true
}

function imgTitle(id, orgVal)
{
    document.getElementById('check_' + (id+999)).checked = ((document.getElementById('img_' + id).value != orgVal) ? true : false);
}

function selCheck(element, id, orgVal)
{
    document.getElementById('check_' + (id+999)).checked = ((element.options[element.selectedIndex].value != orgVal) ? true : false);
}

function fullsize()
{
    var oSource = window.event.srcElement.src;
    tempvar = resized_images[oSource];
    showpopupwindow = window.open('', "_blank","toolbar=no,location=no,menubar=no,scrollbars=no,status=no,left=0,top=0"+tempvar);
    showpopupwindow.document.writeln("<html><head><title>Orginele foto van mijnsexfotos.nl</title>");
    showpopupwindow.document.writeln("</head><body topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">");
    showpopupwindow.document.writeln("<img src=\"" + oSource + "\" onclick=\"window.close()\" title=\"Klik om dit venster te sluiten\">");
    showpopupwindow.document.writeln("</body></html>");
    showpopupwindow.document.close();
}

function resize(image)
{
    if (!image)
    {
        var image = window.event.srcElement;
    }

    width = image.width;
    height = image.height;
    var url = image.src;

    if (width > maxImageWidth)
    {
        resized_images[url] = ",width="+width+",height="+height;
        image.width = maxImageWidth;
        image.title = 'Originele grootte: '+width+'x'+height;
        image.style.border = "dashed 1px red";
        image.style.cursor = "hand";
        image.onclick = fullsize;
        image.height = Math.floor(height/(width/maxImageWidth));
    }
}
function check_images()
{
    count = document.images.length;
    i = 0;

    while(count>i)
    {
        imgurl = document.images[i].src;
        if (imgurl.substring(0, siteurl.length) == siteurl)
        {
            if(document.images[i].complete)
            {
                resize(document.images[i]);
            }
            else
            {
                document.images[i].onload = resize;
            }
        }
        i++;
    }
}

function dHide()
{
    document.getElementById('contentrechts').style.display = 'none';
}

function dOver(t)
{
    if (t == 1)
    {
        document.getElementById('dinfo').innerText = 'Verberg details';
    }
    else
    {
        document.getElementById('dinfo').innerText = 'Details van de foto';
    }
}

function sel(id)
{
    id.focus();
    id.select();
}
   

saveVote = 0;

siteurl = 'http://www.mijnsexfotos.nl/image';

var resized_images = new Array();
var myWidth = 0, myHeight = 0;

if(typeof(window.innerWidth) == 'number') 
{
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
} 
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
{
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
} 
else if (document.body && (document.body.clientWidth || document.body.clientHeight))
{
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
}

maxImageWidth = 750;

function validateForm()
{
    d = document.getElementById('usercat');

    if (d.options[d.selectedIndex].value == "0")
    {
        alert('Kies de juiste categorie voor je upload (verplicht)');
        return false;
    }
    else
    {
        return true;
    }
}

$.ready(function() { 
check_images(); 
resize(); 
});
