// JavaScript Document// JavaScript Document

/************************************Address Manager***********************************/

function address_save(user_id,page,limit){
	//alert("user_id");
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = document.frm_address_add.user_email.value;
	
	if(document.frm_address_add.user_fname.value==''){
		alert("Please Enter First Name")
		document.frm_address_add.user_fname.focus();
		return false;
	}else if(document.frm_address_add.user_lname.value==''){
		alert("Please Enter Last Name")
		document.frm_address_add.user_lname.focus();
		return false;
	}else if(document.frm_address_add.user_email.value==''){
		alert("Please Enter EmailID");
		document.frm_address_add.user_email.focus();
		return false;
	}else if(reg.test(address) == false) {
		alert('Invalid Email Address');
		document.frm_address_add.user_email.focus();
		return false;
	}else if(document.frm_address_add.user_city.value==''){
		alert("Please Enter City")
		document.frm_address_add.user_city.focus();
		return false;
	}else if(document.frm_address_add.lstcountry.value=='0'){
		alert("Please Enter Country")
		document.frm_address_add.lstcountry.focus();
		return false;
	}else if(document.frm_address_add.user_zip.value==''){
		alert("Please Enter Zipcode")
		document.frm_address_add.user_zip.focus();
		return false;
	}else{
		document.frm_address_add.action="address_save.php?page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_address_add.submit();
	}
}

function address_edit(user_address_id,page,limit,user_id)
{
	document.frm_address_mgmt.action="address_add.php?user_address_id="+user_address_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
	document.frm_address_mgmt.submit();
}

function address_delete(user_address_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_address_mgmt.action="address_delete.php?user_address_id="+user_address_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_address_mgmt.submit();	
	}
}

function default_bill_address_change(user_address_id,status,user_id){
	//alert(status);exit;
	document.frm_address_mgmt.action="default_bill_address_change.php?user_address_id="+user_address_id+"&status="+status+"&user_id="+user_id;	
	document.frm_address_mgmt.submit();	
}

function default_ship_address_change(user_address_id,status,user_id){
	document.frm_address_mgmt.action="default_ship_address_change.php?user_address_id="+user_address_id+"&status="+status+"&user_id="+user_id;	
	document.frm_address_mgmt.submit();	
}

function product_save(){
	
	if(document.prod_add.txt_product_name.value==''){
		alert("Please enter product name");
		document.prod_add.txt_product_name.focus();
		return false;
	}else if(document.prod_add.selMetal.value==''){
		alert("Please select metal");
		document.prod_add.selMetal.focus();
		return false;
	}else if(document.prod_add.txt_product_price.value==''){
		alert("Please enter product price");
		document.prod_add.txt_product_price.focus();
		return false;
	}else if(document.prod_add.txt_product_weight.value==''){
		alert("Please enter product weight");
		document.prod_add.txt_product_weight.focus();
		return false;
	}else if(document.prod_add.selItem.value==''){
		alert("Please select item");
		document.prod_add.selItem.focus();
		return false;
	}else if(document.prod_add.selFamily.value==''){
		alert("Please select family");
		document.prod_add.selFamily.focus();
		return false;
	}
}


function upload_image1(){
	if(document.upload_image.main_image.value==''){
		alert("Please enter main photo");
		document.upload_image.main_image.focus();
		return false;
	}else if(document.upload_image.thumb_image.value==''){
		alert("Please enter thumb photo");
		document.upload_image.thumb_image.focus();
		return false;
	}else{
		document.upload_image.action="upload_image_save.php";
		document.upload_image.submit();
	}
}

function add_user_validate(page,limit)
{
	//alert("add");
	if(document.frm_user_add.user_type_id.value==''){
		alert("Please select user type");
		document.frm_user_add.user_type_id.focus();
		return false;
	}else if(document.frm_user_add.user_fname.value==''){
		alert("please enter First Name");
		document.frm_user_add.user_fname.focus();
		return false;
	}else if(document.frm_user_add.user_lname.value==''){
		alert("please enter Last Name");
		document.frm_user_add.user_lname.focus();
		return false;
	}else if(document.frm_user_add.user_email.value == ""){
		alert("Please Enter EmailID");
		document.frm_user_add.user_email.focus();
		return false;
	}else if(document.frm_user_add.user_email.value.indexOf("@") == -1){
		alert("Please enter valid Email");
		document.frm_user_add.user_email.focus();
		return false;
	}else if(document.frm_user_add.user_email.value.indexOf(".") == -1){
		alert("Please enter valid Email");
		document.frm_user_add.user_email.focus();
		return false;
	}else{
		var password=document.frm_user_add.user_pass;
		
		if(password.value==""){
			alert("Please enter your password");
			password.focus();
			return false;
		}else if(password.value.length < 6){
			alert("Your password should contain minimum 6 characters");
			password.focus();
			return false;
		}
		
		var pass_string = password.value;		
		var valid="123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

		for (var i=0; i<pass_string.length; i++) {
        	if (valid.indexOf(pass_string.charAt(i)) < 0) {
            	alert('Your password contains invalid characters');
				password.focus();
            	return false;
        	}
    	}
		
		var alphaCount=0
 		var numCount=0

		var num_valid="123456789";
		
		for (var i=0; i<pass_string.length; i++) {
			if (num_valid.indexOf(pass_string.charAt(i)) < 0) {
			 numCount++;
			}
		}
		if(numCount==pass_string.length){
			alert('Your password contains only characters. Please enter an alphanumeric	value like -alpha1-');
			password.focus();
			return false;
		}
		
		var	alph_valid="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		
		for (var i=0; i<pass_string.length; i++) {
			if (alph_valid.indexOf(pass_string.charAt(i)) < 0) {
				alphaCount++;
			}
		}
		if(alphaCount==pass_string.length){
			alert('Your password contains only numbers. Please enter an alphanumeric value like -alpha1-');
			password.focus();
			return false;
		}
		document.frm_user_add.action="user_save.php?page="+page+"&limit="+limit;
		document.frm_user_add.submit();
	}
		
}

function family_validate(page,limit){
	if(document.frm_family_add.txt_family_name.value==''){
		alert("Please enter family name");
		document.frm_family_add.txt_family_name.focus();
		return false;
	}else if(document.frm_family_add.txt_family_code.value==''){
		alert("Please enter family code");
		document.frm_family_add.txt_family_code.focus();
		return false;
	}else{
		document.frm_family_add.action="family_save.php?page="+page+"&limit="+limit;
		document.frm_family_add.submit();
	}
		
}



function getcatid()
{
	//alert("hiiii");
	document.frm_sub_feature_add.action = "sub_feature_add.php";
	document.frm_sub_feature_add.submit();
}

function user_edit(id)
{
	document.frm_user_mgmt.user_id.value=id;
	//alert(document.frm_user_mgmt.user_id.value);
	document.frm_user_mgmt.action = "user_add.php?user_id="+id;
	document.frm_user_mgmt.submit();
}

function user_delete(id)
{
	//document.frm_user_mgmt.user_id.value=id;
	document.frm_user_mgmt.action = "user_delete.php?user_id="+id;
	document.frm_user_mgmt.submit();
}

function page_edit(id)
{
	//document.frm_user_mgmt.user_id.value=id;
	//alert(document.frm_user_mgmt.user_id.value);
	document.frm_page_mgmt.action = "page.php?page_id="+id;
	document.frm_page_mgmt.submit();
}
function page_delete(id)
{
	//document.frm_user_mgmt.user_id.value=id;
	document.frm_page_mgmt.action = "page.php?user_id="+id;
	document.frm_page_mgmt.submit();
}
function FAQ_edit(id)
{
	//alert("edit"+id);
	document.frm_faq_mgmt.action="faq_add.php?FAQ_id="+id;
	document.frm_faq_mgmt.submit();
}
function FAQ_delete(id)
{
	//alert("delete"+id);
	document.frm_faq_mgmt.action="faq_delete.php?FAQ_id="+id;
	document.frm_faq_mgmt.submit();
}
function case_edit(id)
{
	//alert("edit"+id);
	document.frm_case_mgmt.action="case_add.php?case_id="+id;
	document.frm_case_mgmt.submit();
}
function case_delete(id)
{
	//alert("delete"+id);
	document.frm_case_mgmt.action="case_delete.php?case_id="+id;
	document.frm_case_mgmt.submit();
}
function faq_cat_edit(id)
{	//alert("edit"+id);
	document.frm_faq_cat_mgmt.action="faq_cat_add.php?faq_cat_id="+id;
	document.frm_faq_cat_mgmt.submit();
}
function faq_cat_delete(id)
{
	//alert("delete"+id);
	document.frm_faq_cat_mgmt.action="faq_cat_delete.php?faq_cat_id="+id;
	document.frm_faq_cat_mgmt.submit();
}
function country_edit(country_id,page,limit)  
{  
	document.frm_country_mgmt.action="country_add.php?country_id="+country_id+"&page="+page+"&limit="+limit;
	document.frm_country_mgmt.submit();
}
function country_delete(country_id,page,limit)
{    
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_country_mgmt.action="country_delete.php?country_id="+country_id+"&page="+page+"&limit="+limit;
		document.frm_country_mgmt.submit();	
	}
}

function country_save(page,limit)
{ 
	if(document.frm_country_add.country_name.value=='')
	{
		alert("Please Enter Country")
		document.frm_country_add.country_name.focus();
		return false;
	}
		document.frm_country_add.action="country_save.php?page="+page+"&limit="+limit;
		document.frm_country_add.submit();
}
function region_save(page,limit,catphoto)
{  
 if(document.frm_region_add.region_name.value=='')
	{
		alert("Please Enter Region Name")
		document.frm_region_add.region_name.focus();
		return false;
	}
document.frm_region_add.action="region_save.php?page="+page+"&limit="+limit;
		document.frm_region_add.submit();
}
function region_edit(region_id,page,limit)  
{  
document.frm_region_mgmt.action="region_add.php?region_id="+region_id+"&page="+page+"&limit="+limit;
	document.frm_region_mgmt.submit();
}
function region_delete(region_id,page,limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_region_mgmt.action="region_delete.php?region_id="+region_id+"&page="+page+"&limit="+limit;
		document.frm_region_mgmt.submit();	
	}
}

function post_save(page,limit,catphoto)
{  
	if(document.frm_post_add.post_title.value=='')
	{
		alert("Please Enter Post Title")
		document.frm_post_add.post_title.focus();
		return false;
	}
	if(document.frm_post_add.post_desc.value=='')
	{
		alert("Please Enter Post Description")
		document.frm_post_add.post_desc.focus();
		return false;
	}
	if(document.frm_post_add.post_contact_person.value=='')
	{
		alert("Please Enter Contact Person")
		document.frm_post_add.post_contact_person.focus();
		return false;
	}
	if(document.frm_post_add.post_telephone.value=='')
	{
		alert("Please Enter Telephone")
		document.frm_post_add.post_telephone.focus();
		return false;
	}
	
document.frm_post_add.action="post_save.php?page="+page+"&limit="+limit;
document.frm_post_add.submit();
}

function post_save_user(page,limit,catphoto)
{  
	if(document.frm_post_add.post_title.value=='')
	{
		alert("Please Enter Post Title")
		document.frm_post_add.post_title.focus();
		return false;
	}
	/*if(document.frm_post_add.post_desc.value=='')
	{
		alert("Please Enter Post Description")
		document.frm_post_add.post_desc.focus();
		return false;
	}*/
	if(document.frm_post_add.post_contact_person.value=='')
	{
		alert("Please Enter Contact Person")
		document.frm_post_add.post_contact_person.focus();
		return false;
	}
	if(document.frm_post_add.post_telephone.value=='')
	{
		alert("Please Enter Telephone")
		document.frm_post_add.post_telephone.focus();
		return false;
	}
	
document.frm_post_add.action="post_save.php";
document.frm_post_add.submit();
}


function information_save(page,limit)
{  	
document.frm_information_add.action="information_save.php?page="+page+"&limit="+limit;
document.frm_information_add.submit();
}

function event_save(page,limit)
{  	
document.frm_event_add.action="event_save.php?page="+page+"&limit="+limit;
document.frm_event_add.submit();
}

function post_edit(post_id,page,limit)  
{  
document.frm_post_mgmt.action="post_add.php?post_id="+post_id+"&page="+page+"&limit="+limit;
	document.frm_post_mgmt.submit();
}

function accommodation_edit(accommodation_id,page,limit)  
{  
document.frm_accommodation_mgmt.action="accommodation_add.php?accommodation_id="+accommodation_id+"&page="+page+"&limit="+limit;
	document.frm_accommodation_mgmt.submit();
}

function information_edit(information_id,page,limit)  
{  
document.frm_information_mgmt.action="information_add.php?information_id="+information_id+"&page="+page+"&limit="+limit;
	document.frm_information_mgmt.submit();
}

function event_edit(event_id,page,limit)  
{  
document.frm_event_mgmt.action="event_add.php?event_id="+event_id+"&page="+page+"&limit="+limit;
	document.frm_event_mgmt.submit();
}

function post_edit_user(post_id,page,limit,user_id)  
{  
document.frm_post_replay.action="add_post.php?post_id="+post_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
	document.frm_post_replay.submit();
}
function post_delete(post_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_post_mgmt.action="post_delete.php?post_id="+post_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_post_mgmt.submit();	
	}
}

function post_delete_user_front(post_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{   var f = 1;
		document.frm_post_user.action="admin/post_manager/post_delete.php?post_id="+post_id+"&page="+page+"&limit="+limit+"&user_id="+user_id+"&f="+f;		
		document.frm_post_user.submit();	
	}
}

function business_delete_user(business_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{   var f = 1;
		document.frm_business_user.action="admin/business_manager/business_delete.php?business_id="+business_id+"&page="+page+"&limit="+limit+"&user_id="+user_id+"&f="+f;
		document.frm_business_user.submit();	
	}
}

function accommodation_delete(accommodation_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_accommodation_mgmt.action="accommodation_delete.php?accommodation_id="+accommodation_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_accommodation_mgmt.submit();	
	}
}

function information_delete(information_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_information_mgmt.action="information_delete.php?information_id="+information_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_information_mgmt.submit();	
	}
}

function information_delete_user(information_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{   var f = 1;
		document.frm_information.action="admin/information_manager/information_delete.php?information_id="+information_id+"&page="+page+"&limit="+limit+"&user_id="+user_id+"&f="+f;
		document.frm_information.submit();	
	}
}

function event_delete(event_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_event_mgmt.action="event_delete.php?event_id="+event_id+"&page="+page+"&limit="+limit+"&user_id="+user_id;
		document.frm_event_mgmt.submit();	
	}
}

function post_delete_user_(post_id,page,limit,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{   var f = 1;
	document.frm_post_replay.action="admin/post_manager/post_delete.php?post_id="+post_id+"&page="+page+"&limit="+limit+"&f="+f+"&user_id="+user_id;
		document.frm_post_replay.submit();	
	}
}
function post_replay_save(page,limit,catphoto,post_id,user_id)
{  
	document.frm_post_replay_add.action="post_replay_save.php?page="+page+"&limit="+limit+"&post_id="+post_id+"&user_id="+user_id;
	document.frm_post_replay_add.submit();
}

function post_replay_edit(post_replay_id,page,limit,post_id,user_id)  
{  
document.frm_post_replay_mgmt.action="post_replay_add.php?post_replay_id="+post_replay_id+"&page="+page+"&limit="+limit+"&post_id="+post_id+"&user_id="+user_id;
	document.frm_post_replay_mgmt.submit();
}

function post_replay_delete(post_replay_id,page,limit,post_id,user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{  
		document.frm_post_replay_mgmt.action="post_replay_delete.php?post_replay_id="+post_replay_id+"&page="+page+"&limit="+limit+"&post_id="+post_id+"&user_id="+user_id;
		document.frm_post_replay_mgmt.submit();	
	}
}

function photo_edit(post_img_id,page,limit,post_id,post_by)
{
	document.frm_photo_mgmt.action="photo_add.php?post_img_id="+post_img_id+"&page="+page+"&limit="+limit+"&post_id="+post_id+"&post_by="+post_by;
	document.frm_photo_mgmt.submit();
}

function photo_accommodation_edit(accommodation_img_id,page,limit,accommodation_id,post_by)
{
	document.frm_photo_mgmt.action="photo_add.php?accommodation_img_id="+accommodation_img_id+"&page="+page+"&limit="+limit+"&accommodation_id="+accommodation_id+"&post_by="+post_by;
	document.frm_photo_mgmt.submit();
}

function photo_edit_user(post_img_id,page,limit,post_id)
{
	document.frm_photo.action="add_photo.php?post_img_id="+post_img_id+"&page="+page+"&limit="+limit+"&post_id="+post_id;
	document.frm_photo.submit();
}
function photo_delete(post_img_id,page,limit,post_id,post_by)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
	document.frm_photo_mgmt.action="photo_delete.php?post_img_id="+post_img_id+"&page="+page+"&limit="+limit+"&post_id="+post_id+"&post_by="+post_by;
		document.frm_photo_mgmt.submit();	
	}
}

function photo_delete_user_event(event_img_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
	document.frm_event_photo.action="event_photo_delete.php?event_img_id="+event_img_id;
		document.frm_event_photo.submit();	
	}
}

function photo_accommodation_delete(accommodation_img_id,page,limit,accommodation_id,post_by)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
	document.frm_photo_mgmt.action="photo_delete.php?accommodation_img_id="+accommodation_img_id+"&page="+page+"&limit="+limit+"&accommodation_id="+accommodation_id+"&post_by="+post_by;
		document.frm_photo_mgmt.submit();	
	}
}

function photo_delete_user(post_img_id,page,limit,post_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{	var f = 1;
		document.frm_photo.action="admin/photo_manager/photo_delete.php?post_img_id="+post_img_id+"&page="+page+"&limit="+limit+"&f="+f+"&post_id="+post_id;
		document.frm_photo.submit();	
	}
}

function photo_save(photo_id,photo_cat_id,page,limit,photo,photobig)
{
	if(document.frm_photo_add.photo_image_url.value=='' && photo=='')
	{
		alert("Please select photo")
		document.frm_photo_add.photo_image_url.focus();
		return false;
	}
	else if(document.frm_photo_add.photo_image_url_big.value=='' && photobig=='')
	{
		alert("Please select Big photo")
		document.frm_photo_add.photo_image_url_big.focus();
		return false;
	}
	else
	{
		document.frm_photo_add.action="photo_save.php?photo_id="+photo_id+"&photo_cat_id="+photo_cat_id+"&page="+page+"&limit="+limit;
		document.frm_photo_add.submit();
	}
}

function photo_save1(post_img_id,page,limit)
{
	
		document.frm_photo_add.action="photo_save.php?post_img_id="+post_img_id+"&page="+page+"&limit="+limit;
		document.frm_photo_add.submit();
	
}


function catPhoto_to_Photo(photo_cat_id)
{
	document.frm_FE_photo_cat.action="photo_details.php?photo_cat_id="+photo_cat_id;
	document.frm_FE_photo_cat.submit();
}
function photo_desc(photo_id)
{
	document.frm_FE_photo.action="photo_description.php?photo_id="+photo_id;
	document.frm_FE_photo.submit();
}
function favorite_delete(user_id)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_view_fav.action="favorite_delete.php?user_fav_id="+user_id;
		document.frm_view_fav.submit();	
	}
}

function check_login(form_name)
{    
	alert(form_name);
	var ans=confirm("First You have to Regiester? or If you have Register user Login First");
	if(ans==true)
	{  
		document.form_name.action="user_registration.php";
		document.form_name.submit();	
	}
	
	
}


/*--------------------------People Manger------------------------------------------------------------*/

function person_save(page,limit)
{
		document.frm_person_add.action="people_save.php?page="+page+"&limit="+limit;
		document.frm_person_add.submit();
}

function person_delete(person_id, page, limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_person_mgmt.action="people_delete.php?person_id="+person_id+"page="+page+"&limit="+limit;
		document.frm_person_mgmt.submit();	
	}
}

/*--------------------------Service Manger------------------------------------------------------------*/

function service_save(page,limit)
{
		document.frm_service_add.action="service_save.php?page="+page+"&limit="+limit;
		document.frm_service_add.submit();
}

function service_delete(service_id, page, limit)
{
	var ans=confirm("Are you sure want to delete?");
	if(ans==true)
	{
		document.frm_service_mgmt.action="service_delete.php?service_id="+service_id+"page="+page+"&limit="+limit;
		document.frm_service_mgmt.submit();	
	}
}
/*--------------------------Business Manger------------------------------------------------------------

function business_edit(id)
{
	document.frm_business_mgmt.business_id.value=id;
	//alert(document.frm_user_mgmt.user_id.value);
	document.frm_business_mgmt.action = "business_mgmt.php?business_id="+id;
	document.frm_business_mgmt.submit();
}

function business_delete(id)
{
	//document.frm_user_mgmt.user_id.value=id;
	document.frm_business_mgmt.action = "business_delete.php?business_id="+id;
	document.frm_business_mgmt.submit();
}*/
/*----------------------------------Government Manager------------------------------*/


function government_save(page,limit)
{
		document.frm_government_add.action="government_save.php?page="+page+"&limit="+limit;
		document.frm_government_add.submit();
}

function useful_number_save(page,limit)
{
		document.frm_useful_number_add.action="useful_number_save.php?page="+page+"&limit="+limit;
		document.frm_useful_number_add.submit();
}
function newsletter_save(page,limit)
{
		document.frm_newsletter_add.action="newsletter_save.php?page="+page+"&limit="+limit;
		document.frm_newsletter_add.submit();
}

/*---------------------------------Feature Manager----------------------------------*/

function feature_validate()
{
	if(document.frm_feature_add.feature_eng_name.value=='')
	{
		alert("Please Enter the Feature Name in English");
		document.frm_feature_add.feature_eng_name.focus();
		return false;
	}
	
	if(document.frm_feature_add.feature_rus_name.value=='')
	{
		alert("Please Enter the Feature Name in Russian");
		document.frm_feature_add.feature_rus_name.focus();
		return false;
	}
	
	
	
}

function sub_feature_validate()
{
	if(document.frm_sub_feature_add.eng_feature.value=='')
	{
		alert("Please Select the Parent Feature in English");
		document.frm_sub_feature_add.eng_feature.focus();
		return false;
	}
	if(document.frm_sub_feature_add.eng_sub_feature_name.value=='')
	{
		alert("Please Enter the Sub-Feature Name in English");
		document.frm_sub_feature_add.eng_sub_feature_name.focus();
		return false;
	}
	if(document.frm_sub_feature_add.rus_feature.value=='')
	{
		alert("Please Select the Parent Feature in Russian");
		document.frm_sub_feature_add.rus_feature.focus();
		return false;
	}
	if(document.frm_sub_feature_add.rus_sub_feature_name.value=='')
	{
		alert("Please Enter the Sub-Feature Name in Russian");
		document.frm_sub_feature_add.rus_sub_feature_name.focus();
		return false;
	}
	
	var isChecked=false;
	for(var i=0;i<document.forms["frm_sub_feature_add"]["chkcat[]"].length;i++){
		if(document.forms["frm_sub_feature_add"]["chkcat[]"][i].checked){
			isChecked=true;
		}
	}
	if(isChecked){
		document.forms["frm_sub_feature_add"].submit();
	}
	else{
		alert('Please select a checkbox');
	}
}

function cat_validate()
{
	
	if(document.frm_cat_add.category_name.value=='')
	{
		alert("Please Enter the Category Name in English");
		document.frm_cat_add.category_name.focus();
		return false;
	}
	if(document.frm_cat_add.category_parent_id.value=='')
	{
		alert("Please Enter the parent Page Link in English");
		document.frm_cat_add.category_parent_id.focus();
		return false;
	}
	if(document.frm_cat_add.rus_category_name.value=='')
	{
		alert("Please Enter the Category Name in Russian");
		document.frm_cat_add.rus_category_name.focus();
		return false;
	}
	if(document.frm_cat_add.rus_category_parent_id.value=='')
	{
		alert("Please Enter the parent Page Link in Russian");
		document.frm_cat_add.rus_category_parent_id.focus();
		return false;
	}
}

function country_validate()
{
	
	if(document.frm_country_add.country_name.value=='')
	{
		alert("Please Enter the Country Name");
		document.frm_country_add.country_name.focus();
		return false;
	}
	if(document.frm_country_add.prefix.value=='')
	{
		alert("Please Enter the Prefix");
		document.frm_country_add.prefix.focus();
		return false;
	}
}

function package_validate()
{
	
	if(document.frm_package_add.eng_package_name.value=='')
	{
		alert("Please Enter the Package Name in English");
		document.frm_package_add.eng_package_name.focus();
		return false;
	}
	if(document.frm_package_add.rus_package_name.value=='')
	{
		alert("Please Enter the Package Name in Russian");
		document.frm_package_add.rus_package_name.focus();
		return false;
	}
	if(document.frm_package_add.price.value=='')
	{
		alert("Please Enter the price for the package");
		document.frm_package_add.price.focus();
		return false;
	}
	if(document.frm_package_add.duration.value=='')
	{
		alert("Please Enter the duration of the package");
		document.frm_package_add.duration.focus();
		return false;
	}
	if(document.frm_package_add.no_of_pictures.value=='')
	{
		alert("Please Enter the number of pictures you want in the package ");
		document.frm_package_add.no_of_pictures.focus();
		return false;
	}
}


/* front side Image change css*/
function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP");  } catch(e) {} //IE
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
   try { return new XMLHttpRequest(); } catch(e) {} //Native Javascript
   alert("XMLHttpRequest not supported");
   return null;
};
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
function doPic(str)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	  //alert(str);
	var url="change_image.php";
	url=url+"?id="+str;
	url=url+"&sid="+Math.random();	
	xmlHttp.onreadystatechange=function() 
							{ 
								if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
								{ 
								//alert(xmlHttp.responseText);
								document.getElementById("change_image").innerHTML=xmlHttp.responseText;
								}
							};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	

}

//Drag Image Start
var dragObject  = null;
var mouseOffset = null;
var dragContainer = null;

function getCanvasWidth() { 
   return document.body.offsetWidth || window.innerWidth; 
} 

function getCanvasHeight() { 
   return document.body.offsetHeight || window.innerHeight; 
} 

function makeContainer(item){
	dragContainer = item;
	dragContainer.style.position = 'relative';
	dragContainer.style.overflow = 'hidden';
}

function getMouseOffset(target, ev){
	ev = ev || window.event;

	var docPos    = getPosition(target);
	var mousePos  = mouseCoords(ev);

	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

function getPosition(obj){
	var left = 0;
	var top = 0;

	//if (document.getElementById('pnlProductPopUpInfo')) { document.getElementById('pnlProductPopUpInfo').style.position = 'absolute'; }	
	
	if (obj.offsetParent) {

		left += obj.offsetLeft ;
		top += obj.offsetTop;		
		
		while (obj = obj.offsetParent) {
			if (parseInt(obj.style.left)) {
				if (!obj.id == 'pnlProductPopUpInfo') {
					left -= parseInt(obj.style.left);
					top -= parseInt(obj.style.top);
				}
			}
		}
	}
	return {x:left, y:top};
}

function mouseCoords(ev){
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
	};
}

function mouseMove(ev){
	ev           = ev || window.event;
	var mousePos = mouseCoords(ev);
	var targWidth, targHeight, targPos;
	var browseWidth, browseHeight;

	browseWidth		=	getCanvasWidth();
	browseHeight	=	getCanvasHeight();

	if(dragObject){	
		if (dragContainer) {
			targWidth  = parseInt(dragContainer.offsetWidth);
			targHeight = parseInt(dragContainer.offsetHeight);
			if (((mousePos.y - mouseOffset.y) < 0) && ((mousePos.y - mouseOffset.y + dragObject.height) > (targHeight)))	{dragObject.style.top	= (mousePos.y - mouseOffset.y) + 'px';}
			if (((mousePos.x - mouseOffset.x) < 0) && ((mousePos.x - mouseOffset.x + dragObject.width) > (targWidth)))	{dragObject.style.left	= (mousePos.x - mouseOffset.x) + 'px';}
		} else {
			dragObject = null;
		}
		return false;
	}
}

function mouseUp(){
		dragObject = null;
}

function makeDraggable(item){
	if(!item) return;
	try {item.style.cursor = 'pointer';} catch (e) {} //cursor property breaks IE5.5
	item.onmousedown = function(ev){		
		dragObject  = this;
		dragObject.style.position = 'absolute';
		mouseOffset = getMouseOffset(this, ev);
		return false;
	}
}

function enableDrag(spContainer, imgDrag, imgWidth, imgHeight) {

	var dragItem = null;
	var dragCont = null;
	var contW, contH = 0;
	var top, left;
	
	document.onmousemove = mouseMove;
	document.onmouseup   = mouseUp;
	
	dragCont = document.getElementById(spContainer);
	makeContainer(dragCont);

	dragItem = document.getElementById(imgDrag);
	makeDraggable(dragItem);
	dragItem.style.position = 'absolute';
	
	dragItem.style.height = imgHeight + 'px'; dragItem.style.width = imgWidth + 'px';
	
	dragItem.style.top = 0; dragItem.style.left = 0;
	dragItem.top = 0; dragItem.left = 0;
		
	top = -((parseInt(dragItem.style.height)/2) - (parseInt(dragCont.style.height)/2));
	left = -((parseInt(dragItem.style.width)/2) - (parseInt(dragCont.style.width)/2));
	
	dragItem.style.top = top +'px';
	dragItem.style.left = left+'px';
	
	dragItem.top = dragItem.style.top;
	dragItem.left = dragItem.style.left;
	
	dragItem.alt = 'Click and hold to drag image';	
}
//Drag Image End
var newwindow;
function poptastic()
{
	newwindow=window.open("size_reader.php",'name','toolbar=no,location=no,directories=no,margin=0,status=no,menubar=no,resizable=yes,height=750,width=476');
	if (window.focus) {newwindow.focus()}
}

function chkbox_validation()
{
	if(!document.frmCustomProduct.chk_image.checked){
		alert("Please accept the copyright issue of the image uploaded");
		document.frmCustomProduct.chk_image.focus();
		return false;
	}	
}

