var tmp_str_qurStrindex = "?affid=131&schid=0&affcatid=0&afflayid=71&affrow=1&affcols=2&";
var tmp_str_qurStrinside = "?affid=131&schid=0&affcatid=0&afflayid=71&affrow=5&affcols=3&";

function dispsearch(tmp_str_dispFlag)
{
	/* Getting server url below */
	tmp_str_serverUrl = location.href; 
	tmp_str_qurStr1 = window.location.search.substring(1);

	/* if listing page then show only search box else show categories & search box */
	if(tmp_str_dispFlag=="dispSearch")
	{
	tmp_str_qurStr1 =  tmp_str_qurStr1+"&affdisp=affsearch&url="+tmp_str_serverUrl;	
	}
	else if(tmp_str_dispFlag=="dispCatSearch")
	{
	tmp_str_qurStr1 =  tmp_str_qurStr1+"affdisp=dispCatSearch&url="+tmp_str_serverUrl; 	
	}

	//tmp_str_fName = "http://www.itsmytemplates.com/ajax.htm"; 
	//filedtl = tmp_str_fName+tmp_str_qurStrinside+tmp_str_qurStr1;  

	//filedtl = filedtl.replace("www.itsmytemplates.com","192.168.0.225:81/flexi-affiliate");
	//document.write(filedtl);
	
	tmp_str_fName = "http://www.itsmytemplates.com/ajax.htm";
	filedtl = tmp_str_fName+tmp_str_qurStrinside+tmp_str_qurStr1;
	//alert(filedtl);
	
	
	
	//document.write('<div id="tmpLoad" class="errortext"><img src="http://www.itsmytemplates.com/images/loading.gif" border="0"> Template Loading</div>');

	document.write('<iframe frameborder="0" scrolling="no" HEIGHT="2210" WIDTH="100%"  name="mainFrame" id="mainFrame" onload="parent.scrollTo(0,0);" src="'+filedtl+'" ><'+'/iframe>'); 
	//document.getElementById("tmpLoad").innerHTML = '';
} 

function dispCat()
{ 
 tmp_str_fName = "http://www.itsmytemplates.com/internal_request.php?affdisp=affcat";  
 getCategory(tmp_str_fName,'cat');
 handleCategory();
} 


function gettemplates()
{ 
 tmp_str_qurStr1 = window.location.search.substring(1);
 tmp_str_qurStr1 =  tmp_str_qurStr1+"&affdisp=afftemp";
 tmp_str_fName = "http://www.itsmytemplates.com/internal_request.php"; 
 filedtl = tmp_str_fName+tmp_str_qurStrinside+tmp_str_qurStr1;
 //alert(filedtl);
 getProduct(filedtl,'prod');
 handleProducts();
} 

function getfeaturedtemplates()
{
 tmp_str_qurStr1 = window.location.search.substring(1);
 tmp_str_qurStr1 =  tmp_str_qurStr1+"&affdisp=afffeaturetemp";
 tmp_str_fName = "http://www.affiliate.flexitemplates.com/internal_request.php"; 
 filedtl = tmp_str_fName+tmp_str_qurStrindex+tmp_str_qurStr1;
 //alert(filedtl);
 getProduct(filedtl,'prod');
 handleProducts();
}

function chnageFramSrc(tmp_str_querySting)
{  
 location.href="listing.html?"+tmp_str_querySting;
}

function createRequestObject() 
{
	FORM_DATA = new Object();
	// The Object ("Array") where our data will be stored.
	separator = ',';
	// The token used to separate data from multi-select inputs
	query = '' + this.location;
	qu = query
	// Get the current URL so we can parse out the data.
	// Adding a null-string '' forces an implicit type cast
	// from property to string, for NS2 compatibility.
	query = query.substring((query.indexOf('?')) + 1);
	// Keep everything after the question mark '?'.
	if (query.length < 1) { return false; }  // Perhaps we got some bad data?
	keypairs = new Object();
	numKP = 1;
	// Local vars used to store and keep track of name/value pairs
	// as we parse them back into a usable form.
	while (query.indexOf('&') > -1) {
	keypairs[numKP] = query.substring(0,query.indexOf('&'));
	query = query.substring((query.indexOf('&')) + 1);
	numKP++;
	// Split the query string at each '&', storing the left-hand side
	// of the split in a new keypairs[] holder, and chopping the query
	// so that it gets the value of the right-hand string.
	}
	keypairs[numKP] = query;
	// Store what's left in the query string as the final keypairs[] data.<
	for (i in keypairs) {
		keyName = keypairs[i].substring(0,keypairs[i].indexOf('='));
		// Left of '=' is name.
		keyValue = keypairs[i].substring((keypairs[i].indexOf('=')) + 1);
		// Right of '=' is value.
		while (keyValue.indexOf('+') > -1) {
			keyValue = keyValue.substring(0,keyValue.indexOf('+')) + ' ' + keyValue.substring(keyValue.indexOf('+') + 1);
			// Replace each '+' in data string with a space.
		}
		keyValue = unescape(keyValue);
		// Unescape non-alphanumerics
		if (FORM_DATA[keyName]) {
			FORM_DATA[keyName] = FORM_DATA[keyName] + separator + keyValue;
			// Object already exists, it is probably a multi-select input,
			// and we need to generate a separator-delimited string
			// by appending to what we already have stored.
		} else {
			FORM_DATA[keyName] = keyValue;
			// Normal case: name gets value.
		}
	}
	return FORM_DATA;
}

function show_search_box(tmp_str_searchDivId)
{
	document.getElementById(tmp_str_searchDivId).style.display = "";
}

function hide_search_box(tmp_str_searchDivId)
{
	document.getElementById(tmp_str_searchDivId).style.display = "none";
}
