
var hostName = 'http://www.talentwatchers.com';

function onLoadAdminCommonFunction() {
	highlightFormElements();
	highlightsRowsInit();
	MM_preloadImages('http://www.talentwatchers.com/admin_images/slide_right.jpg', 
					'http://www.talentwatchers.com/admin_images/slide_left.jpg', 
					'http://www.talentwatchers.com/admin_images/admin_left_bar.jpg', 
					'http://www.talentwatchers.com/admin_images/bg_top_line.jpg', 
					'http://www.talentwatchers.com/admin_images/admin_right_bar.jpg', 
					'http://www.talentwatchers.com/admin_images/icon_inactive.gif', 
					'http://www.talentwatchers.com/admin_images/icon_active.gif', 
					'http://www.talentwatchers.com/admin_images/icon_edit.gif', 
					'http://www.talentwatchers.com/admin_images/icon_add.gif', 
					'http://www.talentwatchers.com/admin_images/icon_delete.gif', 
					'http://www.talentwatchers.com/admin_images/delete_image.png', 
					'http://www.talentwatchers.com/admin_images/icon_open.gif', 
					'http://www.talentwatchers.com/admin_images/icon_password.gif', 
					'http://www.talentwatchers.com/admin_images/loader.gif', 
					'http://www.talentwatchers.com/admin_images/icon_error.gif', 
					'http://www.talentwatchers.com/admin_images/icon_changeaccess.gif', 
					'http://www.talentwatchers.com/admin_images/icon_lock.gif', 
					'http://www.talentwatchers.com/admin_images/icon_unlock.gif');
					
					
}



function changeIconColor(ID){
	var $obj = document.getElementById(ID);
	$obj.className = 'icon_box_hover';
}

function restoreIconColor(ID){
	var $obj = document.getElementById(ID);
	$obj.className = 'icon_box';
}

function popupWindowAdmin(path, where, hite, wide){
	if (window.event){ 
		window.event.returnValue = false;   
	}
	var width;
	var height;
	var imgWidth;
	var imgHeight;
	
	if (screen.width<wide){
		width=screen.width-20;
		imgWidth=width-10;
		var windowX = (screen.width-width)/2;
	}
	else{
		var windowX = (screen.width-wide)/2;
		width=wide;
	}

	if (screen.height<hite){
		height=screen.height-70;
		imgHeight=height-20;
		var windowY = (screen.height-height)/2-30;
	}
	else{
		var windowY = (screen.height-hite)/2-10;
		height=hite;
	}

	var rand_no = Math.random();
	var i = Math.round(100*Math.random());
	if(screen.height<hite || screen.width<wide){
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	else{
		var props=window.open(path, i, 'scrollbars=0,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	props.moveTo(windowX,windowY);
}

function findPosX(obj){
	var curleft = 0;
	if(obj.offsetParent)
		while(1){
		  curleft += obj.offsetLeft;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj){
	var curtop = 0;
	if(obj.offsetParent)
		while(1){
		  curtop += obj.offsetTop;
		  if(!obj.offsetParent)
			break;
		  obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}



/*******************************************************
Highlights table rows
*******************************************************/

var marked_row = new Array;

function highlightsRowsInit() {
	// for every table row ...
    var rows = document.getElementsByTagName('tr');
    for ( var i = 0; i < rows.length; i++ ) {
        // ... with the class 'odd' or 'even' ...
        if ( 'odd_tr' != rows[i].className.substr(0,6) && 'even_tr' != rows[i].className.substr(0,7) ) {
            continue;
        }
        // ... add event listeners ...
        // ... to highlight the row on mouseover ...
        if ( navigator.appName == 'Microsoft Internet Explorer' ) {
            // but only for IE, other browsers are handled by :hover in css
            rows[i].onmouseover = function() {
                this.className += ' mouseHover';
            }
            rows[i].onmouseout = function() {
                this.className = this.className.replace( ' mouseHover', '' );
            }
        }
        // Do not set click events if not wanted
        if (rows[i].className.search(/noclick/) != -1) {
            continue;
        }
        // ... and to mark the row on click ...
        rows[i].onmousedown = function() {
            var unique_id;
            var checkbox;

            checkbox = this.getElementsByTagName( 'input' )[0];
            if ( checkbox && checkbox.type == 'checkbox' ) {
                unique_id = checkbox.name + checkbox.value;
            } else if ( this.id.length > 0 ) {
                unique_id = this.id;
            } else {
                return;
            }

            if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
                marked_row[unique_id] = true;
            } else {
                marked_row[unique_id] = false;
            }

            if ( marked_row[unique_id] ) {
                this.className += ' selected_bg';
            } else {
                this.className = this.className.replace(' selected_bg', '');
            }

            if ( checkbox && checkbox.disabled == false ) {
                checkbox.checked = marked_row[unique_id];
            }
        }

        // ... and disable label ...
        var labeltag = rows[i].getElementsByTagName('label')[0];
        if ( labeltag ) {
            labeltag.onclick = function() {
                return false;
            }
        }
        // .. and checkbox clicks
        var checkbox = rows[i].getElementsByTagName('input')[0];
        if ( checkbox ) {
            checkbox.onclick = function() {
                // opera does not recognize return false;
                this.checked = ! this.checked;
            }
        }
    }
}


function markAllSelectedRows(container_id) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            if ( checkbox.disabled == false ) {
                checkbox.checked = true;
                if ( typeof(marked_row[unique_id]) == 'undefined' || !marked_row[unique_id] ) {
                    rows[i].className += ' selected_bg';
                    marked_row[unique_id] = true;
                }
            }
        }
    }
    return true;
}


function unMarkSelectedRows( container_id ) {
    var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {

        checkbox = rows[i].getElementsByTagName( 'input' )[0];

        if ( checkbox && checkbox.type == 'checkbox' ) {
            unique_id = checkbox.name + checkbox.value;
            checkbox.checked = false;
            rows[i].className = rows[i].className.replace(' selected_bg', '');
            marked_row[unique_id] = false;
        }
    }

    return true;
}



/*******************************************************
Highlights input boxes
*******************************************************/

function highlightFormElements() {
    // add input box highlighting
    addFocusHandlers(document.getElementsByTagName("input"));
    addFocusHandlers(document.getElementsByTagName("textarea"));
}

function addFocusHandlers(elements) {
    for (i=0; i < elements.length; i++) {
        if (elements[i].type != "button" && elements[i].type != "submit" && 
            elements[i].type != "reset" && elements[i].type != "checkbox" && elements[i].type != "radio" && elements[i].type != "image") {
            if (!elements[i].getAttribute('readonly') && !elements[i].getAttribute('disabled')) {
                /*elements[i].onfocus=function() {this.style.backgroundColor='#ffd'; this.select()};
                elements[i].onmouseover=function() {this.style.backgroundColor='#ffd'};
                elements[i].onblur=function() {this.style.backgroundColor='';}
                elements[i].onmouseout=function() {this.style.backgroundColor='';}*/
				
				elements[i].onfocus=function() {this.className = 'look_selected'; this.select()};
                elements[i].onmouseover=function() {this.style.backgroundColor=''; this.className = 'look_selected';};
                elements[i].onblur=function() {this.style.backgroundColor=''; this.className = 'look';}
                elements[i].onmouseout=function() {this.style.backgroundColor=''; this.className = 'look';}
				elements[i].onkeyup=function() {this.style.backgroundColor=''; this.className = 'look_selected';}
				elements[i].onkeypress=function() {this.style.backgroundColor=''; this.className = 'look_selected';}
            }
        }
    }
}


/*******************************************************
Preloader
*******************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function roll_over(imgname,imgsrc) {
	document[imgname].src=imgsrc;
}

/*******************************************************
AJAX handler
*******************************************************/


if(window.ActiveXObject) {
	try {
		var oHTTP = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
		var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
	}
} else {
	var oHTTP = new XMLHttpRequest();
}


function menuHide(){
	callNewPage(hostName+'/admin/admin_hide_menu.php?mode=chk&uri=');
}

function callNewPage(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			
			if (getValue=="none") {
				document.getElementById('menuPortion').style.display = "none";
				document.getElementById('menuDisp').src = "../admin_images/slide_right.jpg";
			}
			else{
				document.getElementById('menuPortion').style.display = "";
				document.getElementById('menuDisp').src = "../admin_images/slide_left.jpg";
			}
		}
	}
	oHTTP.send(null);
}



function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function roll_over(imgname,imgsrc) {
	document[imgname].src=imgsrc;
}


function colorPicker(){
	var obj = document.forms['configManager'];
	if(obj.elements['adminbgColor']) attachColorPicker(obj.elements['adminbgColor']);
	if(obj.elements['borderColor']) attachColorPicker(obj.elements['borderColor']);
	if(obj.elements['adminTopbgColor']) attachColorPicker(obj.elements['adminTopbgColor']);
	if(obj.elements['adminBottombgColor']) attachColorPicker(obj.elements['adminBottombgColor']);
	if(obj.elements['menuPortionBgColor']) attachColorPicker(obj.elements['menuPortionBgColor']);
	if(obj.elements['menuPortionBorderColor']) attachColorPicker(obj.elements['menuPortionBorderColor']);
	if(obj.elements['ddMenuBgColor']) attachColorPicker(obj.elements['ddMenuBgColor']);
	if(obj.elements['ddMenuBgHoverColor']) attachColorPicker(obj.elements['ddMenuBgHoverColor']);
	if(obj.elements['menuTextColor']) attachColorPicker(obj.elements['menuTextColor']);
	if(obj.elements['menuHoverTextColor']) attachColorPicker(obj.elements['menuHoverTextColor']);
	if(obj.elements['adminRowColor']) attachColorPicker(obj.elements['adminRowColor']);
	if(obj.elements['boxBgColor']) attachColorPicker(obj.elements['boxBgColor']);
	if(obj.elements['boxBorderColor']) attachColorPicker(obj.elements['boxBorderColor']);
	if(obj.elements['adminRowHoverColor']) attachColorPicker(obj.elements['adminRowHoverColor']);
	if(obj.elements['adminRowSelectColor']) attachColorPicker(obj.elements['adminRowSelectColor']);
	if(obj.elements['adminRowEvenColor']) attachColorPicker(obj.elements['adminRowEvenColor']);
	if(obj.elements['adminRowOddColor']) attachColorPicker(obj.elements['adminRowOddColor']);
}






function deleteConfirmRecord(path, toDelete){
	if(confirm('Are you sure to delete this '+toDelete+'?')){
		location.href=''+path+'';
	}
	else{
		return false;	
	}
}




function CreatePageValidation() {
	if(document.forms['createPage'].elements['page_name'].value=="") {
		alert ("Please enter file name.");
		document.forms['createPage'].elements['page_name'].focus();
		return false;
	}
	var page_name = document.forms['createPage'].elements['page_name'].value;
	var space = page_name.indexOf(" ", 0);
	var num = page_name.indexOf(".",0);
	var ch = page_name.charAt(num+1);
	var ext = page_name.indexOf(".php", 0);
	if(space>=0) {
		alert ("White space is not allowed...");
		document.forms['createPage'].elements['page_name'].select();
		return false;
	}
	if(num<0 && ext<=0) {
		alert ("File name must be with extension .php ");
		document.forms['createPage'].elements['page_name'].select();
		return false;
	}
	if(ch ==" " || ch == "." || ch =="" || num==0) {
		alert ("File name is not proper...");
		document.forms['createPage'].elements['page_name'].select();
		return false;
	}
}



function changeStatus_M(tname, idname, changeMode, ID, statusPortion){
	if(changeMode!="" && ID!="" && statusPortion!=""){
		document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeStatusResponse_M(hostName+'/admin/admin_change_status.php?tname='+tname+'&idname='+idname+'&mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion, tname, idname);
	}
}

function changeStatusResponse_M(page, changeMode, ID, statusPortion, tname, idname) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;			
			if (getValue=="none") {
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_inactive.gif" align="absmiddle" alt="Inactive" border="0" onclick="javascript: changeStatus_M(\''+tname+'\',\''+idname+'\',\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
			else{
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_active.gif" align="absmiddle" alt="Active" border="0" onclick="javascript: changeStatus_M(\''+tname+'\',\''+idname+'\',\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
		}
	}
	oHTTP.send(null);
}



function changeStatus(changeMode, ID, statusPortion){
	if(changeMode!="" && ID!="" && statusPortion!=""){
		document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeStatusResponse(hostName+'/admin/admin_change_status.php?mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion);
	}
}

function changeStatusResponse(page, changeMode, ID, statusPortion) {
//document.getElementById(statusPortion).innerHTML = page;
//return false;
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			if (getValue=="none") {
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_inactive.gif" align="absmiddle" alt="Inactive" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
			else{
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_active.gif" align="absmiddle" alt="Active" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
		}
	}
	
	oHTTP.send(null);
}

function changeStatusPicofDay(changeMode, ID, statusPortion){
	if(changeMode!="" && ID!="" && statusPortion!=""){
		document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeStatusResponsePicofDay(hostName+'/admin/admin_change_status.php?mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion);
	}
}

function changeStatusResponsePicofDay(page, changeMode, ID, statusPortion) {
//document.getElementById(statusPortion).innerHTML = page;
//return false;
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			if(getValue=="none"){
				location.href = hostName+'/admin/admin_member_manager.php?mode=pic_of_day';
			}
			/*if (getValue=="none") {
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_inactive.gif" align="absmiddle" alt="Inactive" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
			else{
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_active.gif" align="absmiddle" alt="Active" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}*/
		}
	}
	
	oHTTP.send(null);
}



function changeStatusResources(changeMode, ID, statusPortion){
	if(changeMode!="" && ID!="" && statusPortion!=""){
		document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeStatusResponseResources(hostName+'/admin/admin_change_status.php?mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion);
	}
}

function changeStatusResponseResources(page, changeMode, ID, statusPortion) {
//document.getElementById(statusPortion).innerHTML = page;
//return false;
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			if (getValue=="none") {
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_inactive.gif" align="absmiddle" alt="Inactive" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
			else{
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_active.gif" align="absmiddle" alt="Active" border="0" onclick="javascript: changeStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
		}
	}
	
	oHTTP.send(null);
}



function changeSSLStatus(changeMode, ID, statusPortion){
	if(changeMode!="" && ID!="" && statusPortion!=""){
		document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeSSLStatusResponse(hostName+'/admin/admin_change_status.php?mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion);
	}
}

function changeSSLStatusResponse(page, changeMode, ID, statusPortion) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			if (getValue=="none") {
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_unlock.gif" align="absmiddle" alt="Inactive" border="0" onclick="javascript: changeSSLStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
			else{
				document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/icon_lock.gif" align="absmiddle" alt="Active" border="0" onclick="javascript: changeSSLStatus(\''+changeMode+'\', '+ID+', \''+statusPortion+'\');" title="Change Status" class="changeStatus" />';
			}
		}
	}
	oHTTP.send(null);
}

function deleteImage(changeMode, ID, statusPortion, type){
	if(confirm('Are you sure to delete this '+type+'?')){
		if(changeMode!="" && ID!="" && statusPortion!=""){
			document.getElementById(statusPortion).innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" /> Please wait';
			deleteImageResponse(hostName+'/admin/admin_delete_image.php?mode='+changeMode+'&id='+ID+'', changeMode, ID, statusPortion);
		}
	}
}

function deleteImageResponse(page, changeMode, ID, statusPortion) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			if (getValue=="done") {
				document.getElementById(statusPortion).innerHTML = '';
			}
		}
	}
	oHTTP.send(null);
}

function checkcity()
{
	document.forms['editcity'].elements['abc'].value = 1;
}
function checkcategory()
{
	document.forms['editcategory'].elements['abc'].value = 1;
}
function checkvenue()
{
	document.forms['editvenue'].elements['abc'].value = 1;
}
function checkevent()
{
	document.forms['ages'].elements['abc'].value = 1;
}
function changeevent(frmName)
{
	if(document.forms[frmName].elements['category_id'].options[document.forms[frmName].elements['category_id'].selectedIndex].value =="1")
	{
		document.getElementById('night').style.display = '';
		document.getElementById('other').style.display = 'none';
		
	}
	
	else if(document.forms[frmName].elements['category_id'].options[document.forms[frmName].elements['category_id'].selectedIndex].value =="0")
	{
		document.getElementById('night').style.display = 'none';
		document.getElementById('other').style.display = 'none';
	}
	else
	{
		document.getElementById('night').style.display = 'none';
		document.getElementById('other').style.display = '';
	}
}

function checkcat(frmName)
{
	var category_id = document.forms[frmName].category_id.options[document.forms[frmName].category_id.selectedIndex].value;
	if (category_id != "")
	{
		window.location.href="admin_email_manager.php?category_id="+category_id;
	}
}
function checkcity(frmName)
{
	var category_id = document.forms[frmName].category_id.options[document.forms[frmName].category_id.selectedIndex].value;
	var city_id = document.forms[frmName].city_id.options[document.forms[frmName].city_id.selectedIndex].value;
	if (city_id != "")
	{
		window.location.href="admin_email_manager.php?city_id="+city_id+"&category_id="+category_id;
	}
}

function checkevent(frmName)
{
	var category_id = document.forms[frmName].category_id.options[document.forms[frmName].category_id.selectedIndex].value;
	if (category_id != "")
	{
		window.location.href="admin_event_manager.php?category_id="+category_id;
	}
}




function Disab(val) 
{
	if(val=="low budget")
	{
		document.casting_manager.paymentid.disabled=true;
	}
	else 
	{	
		document.casting_manager.paymentid.disabled=false;
	}

}

function Disab1(val) 
{
	
	if(val=="indi")
	{
		document.casting_manager.time_range.disabled=true;
		document.casting_manager.gmt_range.disabled=true;
	}
	else 
	{	
		document.casting_manager.time_range.disabled=false;
		document.casting_manager.gmt_range.disabled=false;
	}

}

function checkcat(frmName)
{
	var category_id = document.forms[frmName].category_id.options[document.forms[frmName].category_id.selectedIndex].value;
	if (category_id != "")
	{
		window.location.href="admin_casting_manager.php?mode=add_casting&category_id="+category_id;
	}
}

function checkeditcat(frmName)
{
	var category_id = document.forms[frmName].category_id.options[document.forms[frmName].category_id.selectedIndex].value;
	if (category_id != "")
	{
		window.location.href="admin_casting_manager.php?mode=edit_casting&category_id="+category_id;
	}
}

function open_tr1(id){
		
		if(document.forms['casting_manager'].elements['rcat_'+id].checked == true){
		
			document.getElementById('cat_'+id).style.display='';
			var arrlen = document.forms['casting_manager'].elements['sub_cat_'+id].length;
			for(i=0;i<arrlen;i++){
				//document.forms['casting_manager'].elements['sub_cat_'+id][i].checked = true;
			}
		} else {
			var arrlen = document.forms['casting_manager'].elements['sub_cat_'+id].length;
			for(i=0;i<arrlen;i++){
				document.forms['casting_manager'].elements['sub_cat_'+id][i].checked = false;
				document.getElementById('cat_'+id).style.display='none';
			}
		}
		
	}
	
function changeDropdown(formID,elt)
{
	var frm=document.forms[formID];
	var ID = frm.elements[elt].options[frm.elements[elt].selectedIndex].value;
	if(ID!=""){
		document.getElementById('region_status').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeDropdownResponse(hostName+'/admin/admin_change_status.php?mode=countryregion&id='+ID);
	}
}

function changeDropdownResponse(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('region_status').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
} 		
	
function checkcountry(frmName)
{
	var country_region = document.forms[frmName].country_region.options[document.forms[frmName].country_region.selectedIndex].value;
	if (country_region != "")
	{
		window.location.href="casting_region.php?country_region="+country_region;
	}
}


function changeRegionDropdown(){
	var ID = document.getElementById('country').value;
	
	if(ID!=""){
		document.getElementById('show_region').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeRegionDropdownResponse(hostName+'/admin/admin_change_status.php?mode=root_country&id='+ID);
	}
}

function changeRegionDropdownResponse(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('show_region').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
} 


function changeRegionDropdownForNewsletter(){
	var ID = document.getElementById('newsletterCountryFullM').value;
	
	if(ID!=""){
		document.getElementById('show_region').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeRegionDropdownResponse(hostName+'/admin/admin_change_status.php?mode=root_country&id='+ID);
	}
}

function changeRegionDropdownResponseForNewsletter(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('show_region').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}


function changeFullMember(){
	var ID = document.getElementById('newsletterCountryFullM').value;
	
	if(ID!=""){
		document.getElementById('fullMemberCountry').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeFullMemberResponse(hostName+'/admin/admin_change_status.php?mode=fullMember&id='+ID);
	}
}

function changeFullMemberResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('fullMemberCountry').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function changeFullMemberRegion(){
	var ID = document.getElementById('region_full').value;
	
	if(ID!=""){
		document.getElementById('fullMemberRegion').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeFullMemberRegionResponse(hostName+'/admin/admin_change_status.php?mode=fullMemberRegion&id='+ID);
	}
}

function changeFullMemberRegionResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('fullMemberRegion').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}


function changeFreeMember(){
	var ID = document.getElementById('newsletterCountryFreeM').value;
	
	if(ID!=""){
		document.getElementById('freeMemberCountry').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeFreeMemberResponse(hostName+'/admin/admin_change_status.php?mode=freeMember&id='+ID);
	}
}

function changeFreeMemberResponse(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('freeMemberCountry').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function changeFreeMemberRegion(){
	var ID = document.getElementById('region_free').value;
	//alert(ID);
	
	if(ID!=""){
		document.getElementById('freeMemberRegion').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeFreeMemberRegionResponse(hostName+'/admin/admin_change_status.php?mode=freeMemberRegion&id='+ID);
	}
}

function changeFreeMemberRegionResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('freeMemberRegion').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function changeFullSixMember(){
	var ID = document.getElementById('newsletterCountryFullSixM').value;
	
	if(ID!=""){
		document.getElementById('fullSixMemberCountry').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeFullSixMemberResponse(hostName+'/admin/admin_change_status.php?mode=fullSixMember&id='+ID);
	}
}

function changeFullSixMemberResponse(page) {
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('fullSixMemberCountry').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function changeSixMemberRegion(){
	var ID = document.getElementById('region_six').value;
	
	if(ID!=""){
		document.getElementById('sixMemberRegion').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeSixMemberRegionResponse(hostName+'/admin/admin_change_status.php?mode=sixMemberRegion&id='+ID);
	}
}

function changeSixMemberRegionResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('sixMemberRegion').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}


function changeActorResource(){
	var ID = document.getElementById('newsletterActorResource').value;
	
	if(ID!=""){
		document.getElementById('actorResourceMember').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeActorResourceResponse(hostName+'/admin/admin_change_status.php?mode=actorResourceMember&id='+ID);
	}
}

function changeActorResourceResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('actorResourceMember').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function changeActorResourceMemberRegion(){
	var ID = document.getElementById('region_actor').value;
	
	if(ID!=""){
		document.getElementById('actorResourceMemberRegion').innerHTML = '<img src="'+hostName+'/admin_images/loader.gif" align="absmiddle" alt="Loader" border="0" title="Please Wait" class="changeStatus" />';
		changeActorResourceMemberRegionResponse(hostName+'/admin/admin_change_status.php?mode=ActorResourceMemberRegion&id='+ID);
	}
}

function changeActorResourceMemberRegionResponse(page) {
	//alert(page);
	oHTTP.open("GET", page, true);
	oHTTP.onreadystatechange=function() {
		if (oHTTP.readyState==4) {
			var getValue=oHTTP.responseText;
			document.getElementById('actorResourceMemberRegion').innerHTML = getValue;
		}
	}
	oHTTP.send(null);
}

function open_tr(id){
		
		if(document.forms['edit_member_cat'].elements['rcat_'+id].checked == true){
		
			document.getElementById('cat_'+id).style.display='';
			var arrlen = document.forms['edit_member_cat'].elements['sub_cat_'+id].length;
			for(i=0;i<arrlen;i++){
				document.forms['edit_member_cat'].elements['sub_cat_'+id][i].checked = true;
			}
		} else {
			var arrlen = document.forms['edit_member_cat'].elements['sub_cat_'+id].length;
			for(i=0;i<arrlen;i++){
				document.forms['edit_member_cat'].elements['sub_cat_'+id][i].checked = false;
				document.getElementById('cat_'+id).style.display='none';
			}
		}
		
	}
	
	function popupWindow(path, where, hite, wide){
	if (window.event){ 
		window.event.returnValue = false;   
	}
	var width;
	var height;
	var imgWidth;
	var imgHeight;
	
	if (screen.width<wide){
		width=screen.width-20;
		imgWidth=width-10;
		var windowX = (screen.width-width)/2;
	}
	else{
		var windowX = (screen.width-wide)/2;
		width=wide;
	}

	if (screen.height<hite){
		height=screen.height-70;
		imgHeight=height-20;
		var windowY = (screen.height-height)/2-30;
	}
	else{
		var windowY = (screen.height-hite)/2-10;
		height=hite;
	}

	var rand_no = Math.random();
	var i = Math.round(100*Math.random());
	if(screen.height<hite || screen.width<wide){
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	else{
		var props=window.open(path, i, 'scrollbars=1,toolabars=0,resizable=0,status=0,menubar=0,directories=0,location=0,height='+(hite+30)+', width='+(wide+30));
	}
	props.moveTo(windowX,windowY);
}

function popupImageUpload(imageType, ID, frmName, elementName){
	if(ID=='' && document.forms[frmName].elements[elementName].value!=''){
		ID = document.forms[frmName].elements[elementName].value;
	}
	var popupPath = hostName+'/admin/admin_upload_picture.php?type='+imageType+'&ID='+ID+'&formName='+frmName+'&fieldName='+elementName+'';
	popupWindow(popupPath, 1, 500, 500);
}

function popupJobSelect(){
	var popupPath = hostName+'/admin/admin_jobselection.php';
	popupWindow(popupPath, 1, 500, 500);
}
function popupArticleSelect(){
	var popupPath = hostName+'/admin/admin_articleselection.php';
	popupWindow(popupPath, 1, 500, 500);
}

function markAllSelectedRows1(form) {
	var obj = "user_type[]";
	counter= document.forms[form].elements[obj].length;
	for ( var i = 0; i < counter; i++ ) {
	if(document.forms[form].select_all.checked) {
		if(counter==1) {
			document.forms[form].elements[obj].checked=true;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=true;
		}
	}else {
		if(counter==1) {
			document.forms[form].elements[obj].checked=false;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=false;
		}
	}
	}
    return true;
}

function markAllSelectedRowsFree(form) {
	var obj = "user_type_free[]";
	counter= document.forms[form].elements[obj].length;
	for ( var i = 0; i < counter; i++ ) {
	if(document.forms[form].select_all_free.checked) {
		if(counter==1) {
			document.forms[form].elements[obj].checked=true;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=true;
		}
	}else {
		if(counter==1) {
			document.forms[form].elements[obj].checked=false;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=false;
		}
	}
	}
    return true;
}

function markAllSelectedRowsSixMonthFull(form) {
	var obj = "user_type_six_month_full[]";
	counter= document.forms[form].elements[obj].length;
	for ( var i = 0; i < counter; i++ ) {
	if(document.forms[form].select_all_six_month_full.checked) {
		if(counter==1) {
			document.forms[form].elements[obj].checked=true;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=true;
		}
	}else {
		if(counter==1) {
			document.forms[form].elements[obj].checked=false;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=false;
		}
	}
	}
    return true;
}

function markAllSelectedActorResources(form) {
	var obj = "user_type_actor_resources[]";
	counter= document.forms[form].elements[obj].length;
	for ( var i = 0; i < counter; i++ ) {
	if(document.forms[form].select_all_actor_resources.checked) {
		if(counter==1) {
			document.forms[form].elements[obj].checked=true;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=true;
		}
	}else {
		if(counter==1) {
			document.forms[form].elements[obj].checked=false;
		}
		for(i=0; i<=(counter-1); i++) {
			document.forms[form].elements[obj][i].checked=false;
		}
	}
	}
    return true;
}

function other_hear_admin(){
	var ID = document.getElementById('hear').value;
	//alert(ID);
	var getValue = '<br />If other enter here: <input type="text" name="other" value="" class="look"/>';
	if(ID == 'Others'){
		document.getElementById('other_know').innerHTML = getValue;
	} else{
		document.getElementById('other_know').innerHTML = "";
	}
}

