// JavaScript Document
url = 'http://www.nurnur.net';
function JSON_photo_vote(vote_value,photo_id,gallery_id)
{
new Request.JSON().post(url+'/JSON/photo_vote.php','user_id=&vote='+vote_value+'&photo_id='+photo_id+'&gallery_id='+gallery_id);
//$('vote_box').destroy();
location.href=url + '/en/view_photos/'+photo_id+'|'+gallery_id
}
function add_photo_comment(photo_id,user_id,user_photo,full_name)
{
currentTime = new Date();
elem_id = currentTime.getTime();
user_comments = new Element('div',
{
'id':'no_user_notiification',
'html':'
 | '+full_name+' |
| submit |
'
}
)
var comment_starter = $('comment_starter');
user_comments.inject(comment_starter,'after');
}
function add_photo_comment_(full_name,user_photo,elem_id,photo_id,user_id)
{
txt = $('txt'+elem_id).get('value');
if($('tbl'+elem_id))
$('tbl'+elem_id).destroy();
user_comments = new Element('div',
{
'id':'no_user_notiification',
'html':'  | '+full_name+' |
| '+txt+' |
'
}
)
var comment_starter = $('div'+elem_id);
user_comments.inject(comment_starter,'after');
new Request.JSON().post(url+'/JSON/photo_comment.php','user_id=&comment='+txt+'&photo_id='+photo_id);
}
function JSON_photo_set_default(photo_id,gallery_id)
{
getRequest(url+'/JSON/photo_set_default.php', 'photo_id='+photo_id+'&gallery_id='+gallery_id);
//new Request.JSON().post(url+'/JSON/photo_set_default.php','photo_id='+photo_id+'&gallery_id='+gallery_id);
}
function JSON_photo_delete(photo_id,gallery_id)
{
if(confirm("areyou sure to delete the photo ?"))
getRequest(url+'/JSON/photo_delete.php', 'photo_id='+photo_id+'&gallery_id='+gallery_id);
//new Request.JSON().post(url+'/JSON/photo_delete.php','photo_id='+photo_id+'&gallery_id='+gallery_id);
}
function JSON_gallery_delete(gallery_id)
{
if(confirm("are you sure to delete the gallery ?"))
getRequest(url+'/JSON/gallery_delete.php','gallery_id='+gallery_id);
}
function delete_photo_comment(comment_id)
{
if(confirm("are you sure to delete this comment ?"))
getRequest(url+'/JSON/photo_comment_delete.php','comment_id='+comment_id);
}
function goto_gallery()
{
selected_index = $('galleries').value;
if(selected_index != 'select a gallery')
{
location.href=url+'/en/add_photos/'+selected_index
return true;
}
else
{
return false;
}
}
function getRequest(file, values){
new Request.HTML({
url: file,
method: 'post',
evalScript: true
}).send(values);
}
//////////////validation functions
function echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
return false
}
if (str.indexOf(at,(lat+1))!=-1){
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
return false
}
if (str.indexOf(dot,(lat+2))==-1){
return false
}
if (str.indexOf(" ")!=-1){
return false
}
return true
}
function create_gallery()
{
elem_ids = new Array();
if($('title').value.length < 2)
{
elem_ids.push('bullet_1');
}
if($('category').value == 0)
{
elem_ids.push('bullet_2');
}
if(elem_ids.length > 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i 0)
{
for(i=0;i