﻿/*******************************************************
 Set up a script tag that initializes the following 
 elements before including this file.
 
 <script>
    var auth_id = "your authentication code here";
    var uid = "user identification string";
    var uploadtype = "1/2";  // 1 = from PC, 2 = from url
    var height = "XXpx"; // height of form;
    var width = "XXpx"; // width of form;
 </script>
 
*******************************************************/
var varshowtags = 1;
var preuploadfunctioncall;
var redirectpage;
var rndNum = Math.floor(Math.random()*1000001)
 
function getRookeryForm() {
    
    if( typeof( preuploadfunction ) == 'undefined' )
    {
        preuploadfunctioncall = '';
    } else {
        preuploadfunctioncall = '&puf=' + preuploadfunction;
    }
    
	if( typeof( redirectpage ) == 'undefined' )
    {
        redirectpage = '';
    } else {
        redirectpage = '&redirectpage=' + redirectpage;
    }
   
    if(typeof showtags != 'undefined') {
        varshowtags = showtags;
    }
    document.write("<iframe id='workFrame" + rndNum + "' style='border-style:none;' src='http://testrookery.viary.com/rookeryupload.aspx?auid=" + auth_id + preuploadfunctioncall + redirectpage +  "&uid=" + uid + "&uploadtype=" + uploadtype + "&tags=" + varshowtags + "' width='" + width + "' height='" + height + "'  frameborder='0' marginheight='0' marginwidth='0' scrolling='no'></iframe>")
}

function redirectToRookeryForm() {
    document.getElementById("workFrame" + rndNum).location = "http://testrookery.viary.com/rookeryupload.aspx?auid=" + auth_id + preuploadfunctioncall + redirectpage +  "&uid=" + uid + "&uploadtype=" + uploadtype + "&tags=" + varshowtags 
    //location = "http://testrookery.viary.com/rookeryupload.aspx?auid=" + auth_id + "&uploadtype=" + uploadtype ;
}

